[FFmpeg-user] Using FFMpeg to produce LL-HLS

Simon Brown simon.k.brown at gmail.com
Wed Feb 19 17:36:10 EET 2020


On Wed, 19 Feb 2020 at 15:19, Ted Park <kumowoon1025 at gmail.com> wrote:

>
> Hello,
>
> That’s sort of what a remux does in the first place.
> I take it you are going to re-encode after all, can you post the stdout
> and stderr output from running the commands? Is that the only error or are
> there more errors before that message as before?
> You can force the codec tag to be anything with -tag:v $TAG but I doubt
> that is relevant here.
>
> Regards,
> Ted Park
>

No, I'm not going to re-encode - I cannot afford the CPU power.
Yes, that is the only error.  I have done this:
C:\xampp\htdocs>\ffmpeg-20200216-8578433-win64-static\bin\ffmpeg.exe
-fflags igndts+nofillin -i udp://127.0.0.1:9034 -map 0 -c:v copy -an -f
h264 udp://127.0.0.1:9036
in one DOS prompt, and this:
C:\xampp\htdocs>\ffmpeg-20200216-8578433-win64-static\bin\ffmpeg.exe -i
udp://127.0.0.1:9036 -codec copy -an -window_size 5 -extra_window_size 5
-use_timeline 1 -seg_duration 1 -frag_duration 0.2 -streaming 1
-adaptation_sets "id=0,streams=v id=1,streams=a" -dash_segment_type mp4
-ldash 1 -strict experimental -f dash manifest.mpd
in the second DOS prompt.  This gives me a stream that I can view in a
browser, but latency is 8s which is not acceptable.  We need it <1s if at
all possible.

So clearly if I send an h264 stream at the dash muxer it is happy, yet if I
just use the ts with -map 0 -c:v copy -an it doesn't work and gives the
earlier error.
There are other side effects in that it starts complaining about
non-monotonous DTS but that goes away after a while:
ffmpeg version git-2020-02-16-8578433 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va
--enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf
  libavutil      56. 41.100 / 56. 41.100
  libavcodec     58. 70.100 / 58. 70.100
  libavformat    58. 38.101 / 58. 38.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 76.100 /  7. 76.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 3 with DTS 400001, packet 4 with DTS 800000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 5 with DTS 800001, packet 6 with DTS 1200000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 7 with DTS 1200001, packet 8 with DTS 1600000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 9 with DTS 1600001, packet 10 with DTS 2000000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 11 with DTS 2000001, packet 12 with DTS 2400000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 13 with DTS 2400001, packet 14 with DTS 9800000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 15 with DTS 9800001, packet 16 with DTS 10200000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 17 with DTS 10200001, packet 18 with DTS 10600000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001b04824bec0] DTS discontinuity in stream 0:
packet 19 with DTS 10600001, packet 20 with DTS 11000000
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'udp://127.0.0.1:9036?listen':
  Metadata:
    major_brand     : isml
    minor_version   : 512
    compatible_brands: ismlpiff
    encoder         : Lavf58.38.101
  Duration: 00:00:02.70, start: 0.000000, bitrate: N/A
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv),
1920x1080 [SAR 1:1 DAR 16:9], 1874 kb/s, 37.04 fps, 50 tbr, 10000k tbn, 50
tbc (default)
    Metadata:
      handler_name    : VideoHandler
[dash @ 000001b04942f040] Opening 'init-stream0.m4s' for writing
Output #0, dash, to 'manifest.mpd':
  Metadata:
    major_brand     : isml
    minor_version   : 512
    compatible_brands: ismlpiff
    encoder         : Lavf58.38.101
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv),
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1874 kb/s, 37.04 fps, 50 tbr, 12800
tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[dash @ 000001b04942f040] Opening 'chunk-stream0-00001.m4s.tmp' for writing
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 0, current: 0; changing to 1. This may result in incorrect
timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 512, current: 512; changing to 513. This may result in incorrect
timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 1024, current: 1024; changing to 1025. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 1536, current: 1536; changing to 1537. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 2048, current: 2048; changing to 2049. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 2560, current: 2560; changing to 2561. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 3072, current: 3072; changing to 3073. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 12544, current: 12544; changing to 12545. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 13056, current: 13056; changing to 13057. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 13568, current: 13568; changing to 13569. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 14080, current: 14080; changing to 14081. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 14592, current: 14592; changing to 14593. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 15104, current: 15104; changing to 15105. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 15616, current: 15616; changing to 15617. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 16128, current: 16128; changing to 16129. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 16640, current: 16640; changing to 16641. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 17152, current: 17152; changing to 17153. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 17664, current: 17664; changing to 17665. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 18176, current: 18176; changing to 18177. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 18688, current: 18688; changing to 18689. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 19200, current: 19200; changing to 19201. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 19712, current: 19712; changing to 19713. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 20224, current: 20224; changing to 20225. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 20736, current: 20736; changing to 20737. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 21248, current: 21248; changing to 21249. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 21760, current: 21760; changing to 21761. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 22272, current: 22272; changing to 22273. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 22784, current: 22784; changing to 22785. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 23296, current: 23296; changing to 23297. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 23808, current: 23808; changing to 23809. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 24320, current: 24320; changing to 24321. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 24832, current: 24832; changing to 24833. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 25344, current: 25344; changing to 25345. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 25856, current: 25856; changing to 25857. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 26368, current: 26368; changing to 26369. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 26880, current: 26880; changing to 26881. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 27392, current: 27392; changing to 27393. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 27904, current: 27904; changing to 27905. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 28416, current: 28416; changing to 28417. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 28928, current: 28928; changing to 28929. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 29440, current: 29440; changing to 29441. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 29952, current: 29952; changing to 29953. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 30464, current: 30464; changing to 30465. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 30976, current: 30976; changing to 30977. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 31488, current: 31488; changing to 31489. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 32000, current: 32000; changing to 32001. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 32512, current: 32512; changing to 32513. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 33024, current: 33024; changing to 33025. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 33536, current: 33536; changing to 33537. This may result in
incorrect timestamps in the output file.
[dash @ 000001b04942f040] Non-monotonous DTS in output stream 0:0;
previous: 34048, current: 34048; changing to 34049. This may result in
incorrect timestamps in the output file.
udp://127.0.0.1:9036?listen: Immediate exit requested
[dash @ 000001b04942f040] Opening 'manifest.mpd.tmp' for writing
frame=  100 fps=2.5 q=-1.0 Lsize=N/A time=00:00:02.66 bitrate=N/A
speed=0.0664x
video:618kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
Exiting normally, received signal 2.

C:\xampp\htdocs>
C:\xampp\htdocs>qqqqq
C:\xampp\htdocs>\users\simon\Downloads\ffmpeg-20200216-8578433-win64-static\bin\ffmpeg.exe
-i udp://127.0.0.1:9036 -codec copy -an -window_size 5 -extra_window_size 5
-use_timeline 1 -seg_duration 1 -frag_duration 0.2 -streaming 1
-adaptation_sets "id=0,streams=v id=1,streams=a" -dash_segment_type mp4
-ldash 1 -strict experimental -f dash manifest.mpd
ffmpeg version git-2020-02-16-8578433 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va
--enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
--enable-libopenmpt --enable-amf
  libavutil      56. 41.100 / 56. 41.100
  libavcodec     58. 70.100 / 58. 70.100
  libavformat    58. 38.101 / 58. 38.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 76.100 /  7. 76.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, h264, from 'udp://127.0.0.1:9036':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(tv, top first), 1920x1080 [SAR
1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
[dash @ 000002424882ee80] No bit rate set for stream 0
[dash @ 000002424882ee80] Opening 'init-stream0.m4s' for writing
Output #0, dash, to 'manifest.mpd':
  Metadata:
    encoder         : Lavf58.38.101
    Stream #0:0: Video: h264 (Main), yuv420p(tv, top first), 1920x1080 [SAR
1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[dash @ 000002424882ee80] Timestamps are unset in a packet for stream 0.
This is deprecated and will stop working in the future. Fix your code to
set the timestamps properly
[dash @ 000002424882ee80] Opening 'chunk-stream0-00001.m4s.tmp' for writing
[dash @ 000002424882ee80] Opening 'manifest.mpd.tmp' for writing
[dash @ 000002424882ee80] Opening 'chunk-stream0-00002.m4s.tmp' for writing
[dash @ 000002424882ee80] Opening 'manifest.mpd.tmp' for writing
[dash @ 000002424882ee80] Opening 'chunk-stream0-00003.m4s.tmp' for writing
[dash @ 000002424882ee80] Opening 'manifest.mpd.tmp' for writing speed=6.06x
[dash @ 000002424882ee80] Opening 'chunk-stream0-00004.m4s.tmp' for writing


Is the latency because of all the chaff at the start, or is it because of
FFMpeg's start up time, or something else?

Cheers,
Simon


More information about the ffmpeg-user mailing list