1

I'm not good with this stuff, so please dumb things down as much as humanly possible and assume that what I type is probably all i know about ffmpeg.

Okay so I rendered a 1080p video as thousands of 16 bit png images.

I want to take these images and create a 10 bit h.264 video file with either a matroska or avi container. I'll need to add in a .wav file as the sound without re-encoding as well. I'm guessing I can just use this command at any time to do so after its in mkv format in this example: ffmpeg -i original.mkv -i audio.wav -c copy output.mkv

So this is what I have so far: Note I have no idea what the input for PNG images is so I just left it as "input" as you see below. When I do the command below on a normal video file it uses 8 bit. So I need to know the command to specify 10 bit.

ffmpeg -i input -c:v libx264 -preset veryslow -crf 0 output.mkv

enter image description here

enter image description here

(1) ffmpeg -i input.mkv -i audio.wav -c copy output.mkv 
(2) ffmpeg -i input.mkv -i audio.wav -acodec copy output.mkv
(3) ffmpeg -i input.mkv -i audio.wav -c:a copy output.mkv 
(4) ffmpeg -i input.mkv -i audio.wav -vcodec libx264 -acodec copy output.mkv 

Which of these 4 is the best to use if I JUST want to combine video with audio without re-encoding? or is there an even better one to use?I was told -acodec copy is necessary to ensure it doesn't re-encode, but others have told me differently. should I use -acodec copy instead of -c:a copy?

0

1 Answer 1

0

You can use

ffmpeg -i %04d.png -i audio.wav -c:v libx264 -crf 0 -c:a copy output.mkv

where %04d.png represents the pattern for the image filenames. The % is a prefix indicating a numbering pattern is specified afterwards. 04 represents a 4 character pattern, padded with zeros as necessary. d indicates that the characters are numbers.

The particular filename pattern captured in %04d.png is

0001.png
0002.png
0003.png
...

If instead they are

1.png
2.png
3.png
...
999.png
...
9999.png

you would supply %d.png i.e. no padding.

If it's

myimages_00001.png
myimages_00002.png
myimages_00003.png
...

you would use myimages_%05d.png

12
  • 3 questions 1. I need to specify the fps to 5/0.21 (23.80952.....lots more decimals) making sure the decimals are respected the same as they were in my video editor. What command should I tack on to it? 2.If my input is OPENEXR instead of PNG, what would change? 3. Why is it doing 10 bit automatically? I thought we'd have to specify a command to make it 10bit, is it going to 10 bit cause my source footage is 16 bit and can support 10 bit? If i use this on an 8 bit video, its gonna do 8 bit, is there a way to make to change this so if my input is an 8bit it converts to a 10bit h.264 mkv video?
    – kite
    May 18, 2018 at 17:59
  • 1) Add -framerate NUM/DEN before -i. Both have to be integers. 2) Filenames :) 3) Some encoders, like x264, can auto-negotiate pixel formats. It selects the format best able to preserve input fidelity. Add -pix_fmt yuv422p10le after -crf 0 to always set 10-bits.
    – Gyan
    May 18, 2018 at 18:07
  • 1) So I should I make it 500/21 then? Would this lose me 2 decimal places though? IN my vse (blender vse, it uses python and ffmpeg, I added a picture above!), it has an fps value and an fps base. What is the best way to go about this? It states 23.81 in the bar there, it does infact render it with the extra decimals though. Is there a way to specify fps value of 5 then a base like its listed in the ui of blender there?
    – kite
    May 18, 2018 at 18:51
  • As long as you render all frames, it shouldn't matter. Simply specify the rate 500/21 when feeding to ffmpeg.
    – Gyan
    May 18, 2018 at 18:55
  • (1) ffmpeg -i input.mkv -i audio.wav -c copy output.mkv / (2) ffmpeg -i input.mkv -i audio.wav -acodec copy output.mkv / (3) ffmpeg -i input.mkv -i audio.wav -c:a copy output.mkv / (4) ffmpeg -i input.mkv -i audio.wav -vcodec libx264 -acodec copy output.mkv / Which of these 4 is the best to use if I JUST want to combine video with audio without re-encoding? or is there an even better one to use?I was told -acodec copy is necessary to ensure it doesn't re-encode, but others have told me differently. should I use -acodec copy instead of -c:a copy?
    – kite
    May 19, 2018 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.