Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 3 videos:

  • open.avi – 0:46:37.885933 duration
  • middle.avi – 0:02:56.991927 duration
  • fin.avi – 0:02:48.199268 duration

I try to concat 3 videos using command:

$ ffmpeg -i "concat:fin.avi|open.avi|middle.avi" -preset ultrafast -c copy -y vide.avi

ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 16 2013 22:38:01 with gcc 4.8.1 (GCC) 20130603 (Red Hat 4.8.1-1)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib --mandir=/usr/share/man --arch=i686 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-libass --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib --cpu=i686 --enable-runtime-cpudetect
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, avi, from 'concat:fin.avi|open.avi|middle.avi':
  Duration: 00:02:48.20, start: 0.000000, bitrate: 28159 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, 11.20 tbr, 11.20 tbn, 11.20 tbc
Output #0, avi, to 'vide.avi':
  Metadata:
    ISFT            : Lavf54.63.104
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, q=2-31, 11.20 tbn, 11.20 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=27988 fps=2386 q=-1.0 Lsize=  578159kB time=00:41:38.70 bitrate=1895.5kbits/s    
video:577498kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.114549%

When I change the order of input video:

    Input #0, avi, from 'concat:open.avi|middle.avi|fin.avi':
  Duration: 00:46:37.89, start: 0.000000, bitrate: 1692 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, 8.61 tbr, 8.61 tbn, 8.61 tbc
Output #0, avi, to 'vide.avi':
  Metadata:
    ISFT            : Lavf54.63.104
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p, 640x480, q=2-31, 8.61 tbn, 8.61 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=27988 fps=2343 q=-1.0 Lsize=  578159kB time=00:54:11.01 bitrate=1456.9kbits/s    
video:577498kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.114549%

What can I do to fix it?

share|improve this question

migrated from stackoverflow.com Dec 27 '13 at 6:57

This question came from our site for professional and enthusiast programmers.

    
I think it is taking the frame rate of the first input. One shows 2386 and the other 2343. You could explicitly state a framerate and try. But maybe Setpts should also be used. – Rajib Dec 27 '13 at 10:14
    
I try to using concat filter to fix it!!! – nhanpt Dec 30 '13 at 3:56
    
And does it work with the filter? – Rajib Jan 2 '14 at 15:41

I fixed it with re-running ffmpeg on concatenation output using copy streams option. So, with your file names it would be:

ffmpeg -i vide.avi -c copy vide_fixed.avi

I didn't test it with avi though. It was mp4 in my case.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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