[FFmpeg-user] How to split and then concatenate a video file?

Žygimantas Bruzgys un1x0nly at gmail.com
Fri Feb 22 11:32:24 CET 2013


I've also tried to segment and then concatenate avi file with
unpleasable results. Audio plays smoothly, but video get's stuck for
couple of seconds, every couple of seconds. Here's output:

zybru at hp-6530b-bs:~/Desktop$ ffmpeg -i run-mpeg4-mp3.avi -f segment -c
copy -segment_time 3 -segment_list concat.lst -map 0:0 out%03d.avi
ffmpeg version N-50129-g951d39f Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 20 2013 14:47:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-version3 --enable-x11grab
--disable-stripping --enable-debug=3 --extra-cflags=-gstabs+
--disable-optimizations
  libavutil      52. 17.102 / 52. 17.102
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.103 /  3. 38.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 'run-mpeg4-mp4.avi':
  Metadata:
    encoder         : Lavf54.63.100
  Duration: 00:01:20.28, start: 0.000000, bitrate: 568 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46),
yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo,
s16p, 128 kb/s
Output #0, segment, to 'out%03d.avi':
  Metadata:
    encoder         : Lavf54.63.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x576
[SAR 64:45 DAR 16:9], q=2-31, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 2006 fps=0.0 q=-1.0 Lsize=N/A time=00:01:20.24 bitrate=N/A
video:4176kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-100.000514%

zybru at hp-6530b-bs:~/Desktop$ ffmpeg -i run-mpeg4-mp3.avi -c copy -vn
-map 0:1 audio.mp3
ffmpeg version N-50129-g951d39f Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 20 2013 14:47:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-version3 --enable-x11grab
--disable-stripping --enable-debug=3 --extra-cflags=-gstabs+
--disable-optimizations
  libavutil      52. 17.102 / 52. 17.102
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.103 /  3. 38.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 'run-mpeg4-mp3.avi':
  Metadata:
    encoder         : Lavf54.63.100
  Duration: 00:01:20.28, start: 0.000000, bitrate: 568 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46),
yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo,
s16p, 128 kb/s
Output #0, mp3, to 'audio.mp3':
  Metadata:
    TSSE            : Lavf54.63.100
    Stream #0:0: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, 128 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=    1255kB time=00:01:20.28 bitrate= 128.0kbits/s
video:0kB audio:1254kB subtitle:0 global headers:0kB muxing overhead 0.032620%

zybru at hp-6530b-bs:~/Desktop$ ffmpeg -f concat -i concat.lst -c copy out.avi
ffmpeg version N-50129-g951d39f Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 20 2013 14:47:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-version3 --enable-x11grab
--disable-stripping --enable-debug=3 --extra-cflags=-gstabs+
--disable-optimizations
  libavutil      52. 17.102 / 52. 17.102
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.103 /  3. 38.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[concat @ 0x3123fc0] Estimating duration from bitrate, this may be inaccurate
Input #0, concat, from 'concat.lst':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46),
yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf54.63.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x576
[SAR 64:45 DAR 16:9], q=2-31, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 2006 fps=0.0 q=-1.0 Lsize=    4842kB time=00:18:59.04 bitrate=
34.8kbits/s
video:4168kB audio:0kB subtitle:0 global headers:0kB muxing overhead 16.172985%

zybru at hp-6530b-bs:~/Desktop$ ffmpeg -i out.avi -i audio.mp3 -c copy joined.avi
ffmpeg version N-50129-g951d39f Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 20 2013 14:47:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-version3 --enable-x11grab
--disable-stripping --enable-debug=3 --extra-cflags=-gstabs+
--disable-optimizations
  libavutil      52. 17.102 / 52. 17.102
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.103 /  3. 38.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 'out.avi':
  Metadata:
    encoder         : Lavf54.63.100
  Duration: 00:18:59.04, start: 0.000000, bitrate: 34 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46),
yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0x2ee7fa0] max_analyze_duration 5000000 reached at 5016000 microseconds
Input #1, mp3, from 'audio.mp3':
  Metadata:
    encoder         : Lavf54.63.100
  Duration: 00:01:20.28, start: 0.000000, bitrate: 128 kb/s
    Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16p, 128 kb/s
Output #0, avi, to 'joined.avi':
  Metadata:
    ISFT            : Lavf54.63.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x576
[SAR 64:45 DAR 16:9], q=2-31, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 2006 fps=1511 q=-1.0 Lsize=    6179kB time=00:18:59.04 bitrate=
 44.4kbits/s
video:4168kB audio:1254kB subtitle:0 global headers:0kB muxing
overhead 13.953810%

zybru at hp-6530b-bs:~/Desktop$ ffprobe joined.avi
ffprobe version N-50129-g951d39f Copyright (c) 2007-2013 the FFmpeg developers
  built on Feb 20 2013 14:47:49 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree --enable-version3 --enable-x11grab
--disable-stripping --enable-debug=3 --extra-cflags=-gstabs+
--disable-optimizations
  libavutil      52. 17.102 / 52. 17.102
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.103 /  3. 38.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 'joined.avi':
  Metadata:
    encoder         : Lavf54.63.100
  Duration: 00:18:59.04, start: 0.000000, bitrate: 44 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46),
yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo,
s16p, 128 kb/s



Žygimantas Bruzgys


More information about the ffmpeg-user mailing list