Skip to main content
edited title
Link
xpt
  • 8.9k
  • 43
  • 114
  • 168

ffmpeg to convert two-part videos into one

added 568 characters in body
Source Link
xpt
  • 8.9k
  • 43
  • 114
  • 168

UPDATE:

OK. I was hoping to avoid the most complicated one if possible, and I now know that I have to go for the most complicated solution, as explained in LordNeckbeard's reply.

My updated question is, how to combine more than two files together, say three? Because I'm not sure about the syntax. Please confirm if the following is correct:

ffmpeg -i input1.mp4 -i input2.webm  -i input3.avi \
-filter_complex "[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" <encoding options> output.mkv

And explain how to do video scaling and audio volume adjustment in this case.

Thanks

PS my ffmpeg

PS my ffmpeg

UPDATE:

OK. I was hoping to avoid the most complicated one if possible, and I now know that I have to go for the most complicated solution, as explained in LordNeckbeard's reply.

My updated question is, how to combine more than two files together, say three? Because I'm not sure about the syntax. Please confirm if the following is correct:

ffmpeg -i input1.mp4 -i input2.webm  -i input3.avi \
-filter_complex "[0:0] [0:1] [1:0] [1:1] [2:0] [2:1] concat=n=3:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" <encoding options> output.mkv

And explain how to do video scaling and audio volume adjustment in this case.

Thanks

PS my ffmpeg

Source Link
xpt
  • 8.9k
  • 43
  • 114
  • 168

ffmpeg to convert two-part videos into one

ffmpeg has a wiki on Concatenate at
https://trac.ffmpeg.org/wiki/Concatenate

It does concatenation without any conversion. I'm wondering if it is possible to do the concatenation WHILE doing the format conversion. I believe either the following two will do,

 ffmpeg -i Talk-A.MP4 -i Talk-B.MP4 -c:a libvorbis -q:a 5 -c:v libx264 -x264-params crf=22 -pix_fmt yuv420p -y -vf scale=960:-1 -af volume=2 Talk.mkv
 ffmpeg -i "concat:Talk-A.MP4|Talk-B.MP4" -c:a libvorbis -q:a 5 -c:v libx264 -x264-params crf=22 -pix_fmt yuv420p -y -vf scale=960:-1 -af volume=2 Talk.mkv

But both of them only give the result of the first part in the output file.

So I tried exactly as what the wiki suggested:

 ffmpeg -i "concat:Talk-A.MP4|Talk-B.MP4" -c copy Talk.mp4

But that as well produces an output file containing only the first part.

What could be possibly wrong?

PS my ffmpeg

$ ffmpeg --version
ffmpeg version 2.7.2-1~vivid1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
  configuration: --prefix=/usr --extra-version='1~vivid1' --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libdcadec --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-nonfree --enable-libfdk-aac --enable-libvo_aacenc --enable-version3 --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal --enable-libopencv --enable-libx265
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Unrecognized option '-version'.