[FFmpeg-user] segment muxer and hls muxer, strange behavior when seeking

Steffen Deusch steffen at deusch.me
Thu Mar 3 16:25:01 CET 2016


> You are using a few very unusual options (and -strict -1 should 
> not be necessary anymore), please try to reproduce without 
> them.

I removed a couple of options, now the command is:

ffmpeg -ss 1300 -noaccurate_seek -i /root/file.mkv 
-map 0:0 -codec:0 copy -bsf:0 h264_mp4toannexb
-map 0:1 -codec:1 aac -channel_layout:1 stereo
-f segment -segment_time 10 -segment_start_number 130 
media-%05d.ts -start_at_zero -copyts -vsync cfr

ffmpeg version N-78590-g5590ab4 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from '/root/file.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-10-21 21:39:31
  Duration: 00:23:11.23, start: 0.000000, bitrate: 6766 kb/s
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      title           : AC3 5.1 @ 640 kbps
    Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080
    Metadata:
      title           : Full PGS
    Stream #0:4(eng): Subtitle: dvd_subtitle, 1920x1080
    Metadata:
      title           : Full VobSub
Output #0, segment, to 'media-%05d.ts':
  Metadata:
    encoder         : Lavf57.25.100
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
      encoder         : Lavc57.24.103 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 2370 fps=519 q=-1.0 Lsize=N/A time=00:23:11.21 bitrate=N/A speed= 305x       
video:61910kB audio:1501kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Still 147 segments instead of 138 without seeking:

ffmpeg -i /root/file.mkv
-map 0:0 -codec:0 copy -bsf:0 h264_mp4toannexb
-map 0:1 -codec:1 aac -channel_layout:1 stereo
-f segment -segment_time 10 -segment_start_number 0
media-%05d.ts -start_at_zero -copyts -vsync cfr

ffmpeg version N-78590-g5590ab4 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from '/root/file.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-10-21 21:39:31
  Duration: 00:23:11.23, start: 0.000000, bitrate: 6766 kb/s
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      title           : AC3 5.1 @ 640 kbps
    Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080
    Metadata:
      title           : Full PGS
    Stream #0:4(eng): Subtitle: dvd_subtitle, 1920x1080
    Metadata:
      title           : Full VobSub
Output #0, segment, to 'media-%05d.ts':
  Metadata:
    encoder         : Lavf57.25.100
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
      encoder         : Lavc57.24.103 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
frame=34779 fps=482 q=-1.0 Lsize=N/A time=00:23:11.21 bitrate=N/A speed=19.3x    
video:1004463kB audio:22145kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[aac @ 0x321c5c0] Qavg: 516.774

When using HLS:

ffmpeg -ss 1300 -noaccurate_seek -i /root/file.mkv
-map 0:0 -codec:0 copy -bsf:0 h264_mp4toannexb
-map 0:1 -codec:1 aac -channel_layout:1 stereo
-f hls -hls_time 10 -start_number 130 -hls_segment_filename 
media-%05d.ts playlist.m3u8 -start_at_zero -copyts -vsync cfr

ffmpeg version N-78590-g5590ab4 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
  libavutil      55. 18.100 / 55. 18.100
  libavcodec     57. 24.103 / 57. 24.103
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 32.100 /  6. 32.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from '/root/file.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 2013-10-21 21:39:31
  Duration: 00:23:11.23, start: 0.000000, bitrate: 6766 kb/s
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      title           : AC3 5.1 @ 640 kbps
    Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080
    Metadata:
      title           : Full PGS
    Stream #0:4(eng): Subtitle: dvd_subtitle, 1920x1080
    Metadata:
      title           : Full VobSub
Output #0, hls, to 'playlist.m3u8':
  Metadata:
    encoder         : Lavf57.25.100
    Chapter #0:0: start 0.000000, end 484.080000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 484.080000, end 748.680000
    Metadata:
      title           : 00:08:04.080
    Chapter #0:2: start 748.680000, end 1357.200000
    Metadata:
      title           : 00:12:28.680
    Chapter #0:3: start 1357.200000, end 1391.232000
    Metadata:
      title           : 00:22:37.200
    Stream #0:0(eng): Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc (default)
    Metadata:
      title           : Test
    Stream #0:1(ger): Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      title           : AC3 2.0 @ 192 kbps
      encoder         : Lavc57.24.103 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 2370 fps=487 q=-1.0 Lsize=N/A time=00:23:11.21 bitrate=N/A speed= 286x       
video:61910kB audio:1501kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[aac @ 0x35a8900] Qavg: 499.522

> Am 03.03.2016 um 16:08 schrieb Carl Eugen Hoyos <cehoyos at ag.or.at>:
> 
> Steffen Deusch <steffen <at> deusch.me> writes:
> 
>> But now the problem:
>> If we want to start at segment 130 -> ffmpeg with -ss 1300 
>> and -segment_start_number 130, we would expect ffmpeg 
>> generating about 10 segments: 130-138 with 10 seconds 
>> length and 139 with 1 second length
> 
>> But this command will create more than ~140 segments.
> 
> Please provide the command line that produces the unexpected 
> output together with the complete, uncut console output.
> 
> You are using a few very unusual options (and -strict -1 should 
> not be necessary anymore), please try to reproduce without 
> them.
> 
> Carl Eugen
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list