<p>You can use</p>

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

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

<p>The particular filename pattern captured in <code>%04d.png</code> is</p>

<pre><code>0001.png
0002.png
0003.png
...
</code></pre>

<p>If instead they are </p>

<pre><code>1.png
2.png
3.png
...
999.png
...
9999.png
</code></pre>

<p>you would supply <code>%d.png</code> i.e. no padding.</p>

<p>If it's</p>

<pre><code>myimages_00001.png
myimages_00002.png
myimages_00003.png
...
</code></pre>

<p>you would use <code>myimages_%05d.png</code></p>

CC BY-SA 4.0
2018-05-18T17:59:22.660Z
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
CC BY-SA 4.0
2018-05-18T18:07:30.000Z
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
CC BY-SA 4.0
2018-05-18T18:51:02.917Z
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
CC BY-SA 4.0
2018-05-18T18:55:32.587Z
As long as you render all frames, it shouldn't matter. Simply specify the rate `500/21` when feeding to ffmpeg.
Gyan
CC BY-SA 4.0
2018-05-19T03:53:27.337Z
(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
CC BY-SA 4.0
2018-05-19T03:55:22.163Z
Or did you suggest the code with -c:a copy because it was in the same line as the necessary re-encoding so its already re-encoding and it'll just do the operation during the re-encoding and it doesn't matter? It's not gonna re-encode twice or anything will it?
kite
CC BY-SA 4.0
2018-05-19T05:00:40.687Z
One more question (so close to having everything figured out!). With the x264vfw, After I downloaded it, it had the configuration ui thing (I added pictures above and included the code for the previous question formatted). Is this a way to preset options so you don't have to specify them in the ffmpeg command line? And if so, what settings should I use for highest quality encode? I set a test using "single pass - lossless" and didn't include -crf in my command line, and the result was a file smaller than the original, and very good looking! Using single pass quantizer 1 it was 10xfileesize.
kite
CC BY-SA 4.0
2018-05-19T05:18:53.603Z
quantizer was the same but 10x the file size. the render could be a little better still in both. are there any other options I should look at here? Like I'm messing around and I'm noticing the values I change in the configuration are directly affecting the ffmpeg output. im not sure if specifying  the quantizer to 50 in the config  is having an impact if I specify -crf 1 in ffmpeg command line.  I tested but all I can tell is that its respected the command line as an overwrite or its blending the config and command line settings together somehow.
kite
CC BY-SA 4.0
2018-05-19T06:43:02.540Z
Only cmd (1) will avoid video re-encoding. `-acodec` is older form of `-c:a`. Latter form is preferred.
Gyan
CC BY-SA 4.0
2018-05-19T06:44:14.690Z
If you use x264vfw, you should skip video encoding in ffmpeg step. But I don't see choice of pixel format selection in that UI. Also, it uses an older version of x264 which only supports 8-bit.
Gyan
CC BY-SA 4.0
2018-05-19T15:20:24.070Z
Hi are you saying "-c:v libx264" does not use x264vfw? I thought libx264 was the command to 'use' x264vfw. I'm confused cause when I change the configure tab for x264vfw it directly affects the output (quality/size) when using the libx264 command. "When compiled with 10-bit support, x264's quantizer scale is 0–63. You can see what you are using by referring to the ffmpeg console output during encoding (yuv420p or similar for 8-bit, and yuv420p10le or similar for 10-bit)." I was getting yuv420p in my command line, but u helped me and now its yuv420p10le (even without using -pix_fmt yuv422p10le)
kite
CC BY-SA 4.0
2018-05-28T02:42:35.857Z
ya I just confirmed my previous comment was in error. and I understand now that x264vfw has nothing to do with c:v libx264
kite
CC BY-SA 4.0
2018-05-18T07:24:42.920Z
2018-05-18T07:24:42.920Z
Gyan
<p>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.</p>

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

<p>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</p>

<p>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.</p>

<p>ffmpeg -i input -c:v libx264 -preset veryslow -crf 0 output.mkv</p>

<p><a href="https://i.sstatic.net/ORRkg.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ORRkg.jpg" alt="enter image description here"></a></p>

<p><a href="https://i.sstatic.net/Bm8BL.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Bm8BL.jpg" alt="enter image description here"></a></p>

<pre><code>(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 
</code></pre>

<p>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?</p>

<ffmpeg>
How to make PNG video render into 10bit h.264 matroska/avi file?
kite
# How to make PNG video render into 10bit h.264 matroska/avi file?

(Asked by: username_0 on 2018-05-18)

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


(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?

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2018-05-18. Score: 0 | Accepted answer

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

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  
> **username_0**: 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?  
> **username_1**: As long as you render all frames, it shouldn't matter. Simply specify the rate `500/21` when feeding to ffmpeg.  
> **username_0**: (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?  
> **username_0**: Or did you suggest the code with -c:a copy because it was in the same line as the necessary re-encoding so its already re-encoding and it'll just do the operation during the re-encoding and it doesn't matter? It's not gonna re-encode twice or anything will it?  
> **username_0**: One more question (so close to having everything figured out!). With the x264vfw, After I downloaded it, it had the configuration ui thing (I added pictures above and included the code for the previous question formatted). Is this a way to preset options so you don't have to specify them in the ffmpeg command line? And if so, what settings should I use for highest quality encode? I set a test using "single pass - lossless" and didn't include -crf in my command line, and the result was a file smaller than the original, and very good looking! Using single pass quantizer 1 it was 10xfileesize.  
> **username_0**: quantizer was the same but 10x the file size. the render could be a little better still in both. are there any other options I should look at here? Like I'm messing around and I'm noticing the values I change in the configuration are directly affecting the ffmpeg output. im not sure if specifying  the quantizer to 50 in the config  is having an impact if I specify -crf 1 in ffmpeg command line.  I tested but all I can tell is that its respected the command line as an overwrite or its blending the config and command line settings together somehow.  
> **username_1**: Only cmd (1) will avoid video re-encoding. `-acodec` is older form of `-c:a`. Latter form is preferred.  
> **username_1**: If you use x264vfw, you should skip video encoding in ffmpeg step. But I don't see choice of pixel format selection in that UI. Also, it uses an older version of x264 which only supports 8-bit.  
> **username_0**: Hi are you saying "-c:v libx264" does not use x264vfw? I thought libx264 was the command to 'use' x264vfw. I'm confused cause when I change the configure tab for x264vfw it directly affects the output (quality/size) when using the libx264 command. "When compiled with 10-bit support, x264's quantizer scale is 0–63. You can see what you are using by referring to the ffmpeg console output during encoding (yuv420p or similar for 8-bit, and yuv420p10le or similar for 10-bit)." I was getting yuv420p in my command line, but u helped me and now its yuv420p10le (even without using -pix_fmt yuv422p10le)  
> **username_0**: ya I just confirmed my previous comment was in error. and I understand now that x264vfw has nothing to do with c:v libx264  

---

