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

Simon Brown simon.k.brown at gmail.com
Wed Feb 19 14:46:47 EET 2020


>
>
>> C:\xampp\htdocs>\ffmpeg-20200216-8578433-win64-static\bin\ffmpeg.exe -i
> udp://127.0.0.1:9034 -codec copy -b:v 6000k -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 -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, mpegts, from 'udp://127.0.0.1:9034':
>   Duration: N/A, start: 82854.078300, bitrate: N/A
>   Program 1
>     Stream #0:0[0x1100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
> yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 16.67 tbr,
> 90k tbn, 50 tbc
>     Stream #0:1[0x1110]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
> Hz, stereo, fltp, 192 kb/s
> [dash @ 0000020ab5934040] Opening 'init-stream0.m4s' for writing
> [mp4 @ 0000020ab4fbd040] Tag [27][0][0][0] incompatible with output codec
> id '27' (avc1)
> Could not write header for output file #0 (incorrect codec parameters ?):
> Invalid data found when processing input
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
>     Last message repeated 1 times
>
> If instead I try to reencode, the stream information is similar, but
> different:
> [dash @ 00000272b2bec140] Opening 'init-stream0.m4s' for writing
> Output #0, dash, to 'manifest.mpd':
>   Metadata:
>     encoder         : Lavf58.38.101
>     Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR
> 16:9], q=-1--1, 6000 kb/s, 16.67 fps, 45k tbn, 16.67 tbc
>     Metadata:
>       encoder         : Lavc58.70.100 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/6000000 buffer size: 0 vbv_delay: N/A
> [
> So h264 is ok, but Main/avc1 isn't.  But libx264 is ok.  Aren't these much
> the same thing?  What do I need to do to my encoded stream to make the dash
> muxer accept it?
>
> Ok, further tests reveal that it is the TS nature of it that FFmpeg is
complaining about.  If I run two separate ffmpeg commands, the first one
re-encoding with libx264 and outputting mpegts to udp://127.0.0.1:9036 and
the next receiving from udp:9036 and converting to -f dash it throws the
same error "incompatible with output codec id", yet if the encoding goes
straight to the -f dash it's happy.  So now the question becomes:

How do I strip the h264 stream from the ts to feed to -f dash?

Cheers,
Simon

>
>


More information about the ffmpeg-user mailing list