[FFmpeg-user] Better way to merge audio and video? (ffmpeg1.2.1)

Lou lou at lrcd.com
Tue Jul 23 06:14:59 CEST 2013


On Mon, Jul 22, 2013, at 02:33 PM, John Crossman wrote:
> On Mon, Jul 22, 2013 at 3:00 PM, Bouke (VideoToolShed) <
> bouke at videotoolshed.com> wrote:
> 
> > Merge the audio and video into a single video track (i.e., output.mp4)
> >>
> >
> > But you are re-encoding the whole shebang.
> > Try -i audio -i video -vcodec copy -acodec copy outfile

Or simply:
ffmpeg -i audio -i video -c copy output

See description of "stream copy":
https://ffmpeg.org/ffmpeg.html#Stream-copy

Note that by default ffmpeg will only copy one stream of each type:
https://ffmpeg.org/ffmpeg.html#Stream-selection

You can use the -map option to include any or all streams if the default
behavior is not desired.

mp4 output container may not support all of your input formats, so
consider another container format such as Matroska (.mkv) if this is the
case. Or, of course, you can always re-encode if you need mp4.

> Thanks! After one sample run, the output looks good. Much faster.
> 
> Per Lou's comment, regardless of my operation I should never need
> '-qscale'
> (or the equivalent '-q:v') if my configuration includes
> *--enable-libx264 *(which
> it does). Right?

Since your console output indicates that libx264 is the default encoder
for mp4 output then -q:v will be ignored by this encoder resulting in
the default of "-crf 23" (also shown in the console output).


More information about the ffmpeg-user mailing list