[FFmpeg-user] copying segmented stream troubles

Rodrigo Severo rodrigo at fabricadeideias.com
Tue Aug 15 21:08:51 EEST 2017


Hi,


I'm trying to save segmented files of a live stream.

If I save a converted version of the stream (transcoded to webm in
this example) everything works fine:
----------------------------------------------
# /usr/bin/ffmpeg -re -i
http://evcv.mm.uol.com.br/band/terraviva/chunklist_w1904488612.m3u8
-map 0:v -map 0:a -acodec vorbis -strict -2 -ac 2 -vcodec libvpx
-quality realtime -cpu-used 0 -b:v 600k -flags +global_header -f tee
[f=segment:segment_time=900:segment_time_delta=1:reset_timestamps=1:strftime=1]/home/rodrigo/temp/teste+%Y-%m-%d_%H:%M:%S+terraviva.webm
ffmpeg version 3.0.7-0ubuntu0.16.10.1 Copyright (c) 2000-2017 the
FFmpeg developers
  built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.10.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
--enable-shared --disable-stripping --disable-decoder=libopenjpeg
--disable-decoder=libschroedinger --enable-avresample
--enable-avisynth --enable-gnutls --enable-ladspa --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
--enable-libflite --enable-libfontconfig --enable-libfreetype
--enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmodplug --enable-libmp3lame --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-librubberband
--enable-librtmp --enable-libschroedinger --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
--enable-libxvid --enable-libzvbi --enable-openal --enable-opengl
--enable-x11grab --enable-libdc1394 --enable-libiec61883
--enable-libzmq --enable-frei0r --enable-chromaprint --enable-libx264
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.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, hls,applehttp, from
'http://evcv.mm.uol.com.br/band/terraviva/chunklist_w1904488612.m3u8':
  Duration: N/A, start: 39298.092733, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1: Video: h264 (Baseline) ([27][0][0][0] / 0x001B),
yuv420p(tv), 320x240 [SAR 1:1 DAR 4:3], 25 fps, 29.97 tbr, 90k tbn, 50
tbc
    Stream #0:2: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100
Hz, stereo, fltp, 89 kb/s
[libvpx @ 0x55a918487320] v1.5.0
Output #0, tee, to
'[f=segment:segment_time=900:segment_time_delta=1:reset_timestamps=1:strftime=1]/home/rodrigo/temp/teste+%Y-%m-%d_%H:%M:%S+terraviva.webm':
  Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 320x240 [SAR 1:1 DAR
4:3], q=-1--1, 600 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.24.102 libvpx
    Side data:
      unknown side data type 10 (24 bytes)
    Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc57.24.102 vorbis
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> vp8 (libvpx))
  Stream #0:2 -> #0:1 (aac (native) -> vorbis (native))
Press [q] to stop, [?] for help
frame= 2357 fps= 30 q=0.0 Lsize=N/A time=00:01:19.00 bitrate=N/A speed=   1x
video:5826kB audio:1357kB subtitle:0kB other streams:0kB global
headers:3kB muxing overhead: unknown
Exiting normally, received signal 2.
----------------------------------------------

But if I try to save the original stream as it is (using copy) I get
tons of warnings and a broken file with no audio and some freezing and
jumping video:
----------------------------------------------
# /usr/bin/ffmpeg -re -i
http://evcv.mm.uol.com.br/band/terraviva/chunklist_w1904488612.m3u8
-map 0:v -map 0:a -acodec copy -vcodec copy -cpu-used 0 -flags
+global_header -bsf:a aac_adtstoasc -f tee
[f=segment:segment_time=900:segment_time_delta=1:reset_timestamps=1:strftime=1]/home/rodrigo/temp/teste+%Y-%m-%d_%H:%M:%S+terraviva.mp4
ffmpeg version 3.0.7-0ubuntu0.16.10.1 Copyright (c) 2000-2017 the
FFmpeg developers
  built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.10.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl
--enable-shared --disable-stripping --disable-decoder=libopenjpeg
--disable-decoder=libschroedinger --enable-avresample
--enable-avisynth --enable-gnutls --enable-ladspa --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
--enable-libflite --enable-libfontconfig --enable-libfreetype
--enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmodplug --enable-libmp3lame --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-librubberband
--enable-librtmp --enable-libschroedinger --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
--enable-libxvid --enable-libzvbi --enable-openal --enable-opengl
--enable-x11grab --enable-libdc1394 --enable-libiec61883
--enable-libzmq --enable-frei0r --enable-chromaprint --enable-libx264
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.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, hls,applehttp, from
'http://evcv.mm.uol.com.br/band/terraviva/chunklist_w1904488612.m3u8':
  Duration: N/A, start: 39398.155078, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Stream #0:1: Video: h264 (Baseline) ([27][0][0][0] / 0x001B),
yuv420p(tv), 320x240 [SAR 1:1 DAR 4:3], 25 fps, 29.97 tbr, 90k tbn, 50
tbc
    Stream #0:2: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100
Hz, stereo, fltp, 99 kb/s
Output #0, tee, to
'[f=segment:segment_time=900:segment_time_delta=1:reset_timestamps=1:strftime=1]/home/rodrigo/temp/teste+%Y-%m-%d_%H:%M:%S+terraviva.mp4':
  Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p,
320x240 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 29.97 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100
Hz, stereo, 99 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 3, current: 3; changing to 4. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 4, current: 4; changing to 5. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 5, current: 5; changing to 6. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 6, current: 6; changing to 7. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 7, current: 7; changing to 8. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 8, current: 8; changing to 9. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 9, current: 8; changing to 10. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 10, current: 9; changing to 11. This may result in incorrect
timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 11, current: 10; changing to 12. This may result in
incorrect timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 12, current: 11; changing to 13. This may result in
incorrect timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 13, current: 12; changing to 14. This may result in
incorrect timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 14, current: 13; changing to 15. This may result in
incorrect timestamps in the output file.
[tee @ 0x558b6e51b1c0] Non-monotonous DTS in output stream 0:0;
previous: 15, current: 13; changing to 16. This may result in
incorrect timestamps in the output file.
----------------------------------------------

If I don't segment the output, both versions work just fine.

How can I save a segment version of a stream like this without renconding it?


Regards,

Rodrigo Severo


More information about the ffmpeg-user mailing list