[FFmpeg-user] Tnascode H.264 HLS to MPEG2 UDP TS (for DVB-Cbroadcast)

Roman A. Tarasov roman at barsmedia.ru
Wed Feb 27 17:47:13 CET 2013


>> Existing problems:
>> 1. Random hangs (on the server with Xeon E5450 2.4Ghz loaded by 
>> 25-30%), even when reading files from a local web server

>Please provide full uncut console output, with option -loglevel debug
Check that you use recent version.


Console out:
C:\ffmpeg\bin>ffmpeg.exe -v debug -muxpreload 30 -re -threads 0 -i
"http://127.0.0.1/stream.m3u8" -c:v mpeg2video  -pix_fmt yuv420p
-me_meth
od epzs -g 50 -b:v 5000k -bt 300k -c:a mp2 -ac 2 -b:a 256k -ar 48000 -bf
2 -b_strategy 1 -trellis 2 -cmp 2 -subcmp 2 -vstats -mbd rd -copyin
kf -flags +ilme+ildct+qprd+mv0 -flags2 +fast+skiprd -fflags +genpts
-metadata service_provider="TestProv" -metadata service_name="TestChanne
l" -mpegts_start_pid 500 -streamid 1:700 -f mpegts -tune zerolatency
"udp://127.0.0.1:10000?pkt_size=1316&ttl=64"
ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --
enable-gnutls --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libmp3lame
--enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger
--enable-libsoxr --enab
le-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable
-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level)
with argument 'debug'.
Reading option '-muxpreload' ... matched as option 'muxpreload' (set the
initial demux-decode delay) with argument '30'.
Reading option '-re' ... matched as option 're' (read input at native
frame rate) with argument '1'.
Reading option '-threads' ... matched as AVOption 'threads' with
argument '0'.
Reading option '-i' ... matched as input file with argument
'http://127.0.0.1/stream.m3u8'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'mpeg2video'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuv420p'.
Reading option '-me_method' ... matched as AVOption 'me_method' with
argument 'epzs'.
Reading option '-g' ... matched as AVOption 'g' with argument '50'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '5000k'.
Reading option '-bt' ... matched as AVOption 'bt' with argument '300k'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'mp2'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '256k'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '48000'.
Reading option '-bf' ... matched as AVOption 'bf' with argument '2'.
Reading option '-b_strategy' ... matched as AVOption 'b_strategy' with
argument '1'.
Reading option '-trellis' ... matched as AVOption 'trellis' with
argument '2'.
Reading option '-cmp' ... matched as AVOption 'cmp' with argument '2'.
Reading option '-subcmp' ... matched as AVOption 'subcmp' with argument
'2'.
Reading option '-vstats' ... matched as option 'vstats' (dump video
coding statistics to file) with argument '1'.
Reading option '-mbd' ... matched as AVOption 'mbd' with argument 'rd'.
Reading option '-copyinkf' ... matched as option 'copyinkf' (copy
initial non-keyframes) with argument '1'.
Reading option '-flags' ... matched as AVOption 'flags' with argument
'+ilme+ildct+qprd+mv0'.
Reading option '-flags2' ... matched as AVOption 'flags2' with argument
'+fast+skiprd'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument
'+genpts'.
Reading option '-metadata' ... matched as option 'metadata' (add
metadata) with argument 'service_provider=TestProv'.
Reading option '-metadata' ... matched as option 'metadata' (add
metadata) with argument 'service_name=TestChannel'.
Reading option '-mpegts_start_pid' ... matched as AVOption
'mpegts_start_pid' with argument '500'.
Reading option '-streamid' ... matched as option 'streamid' (set the
value of an outfile streamid) with argument '1:700'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'mpegts'.
Reading option '-tune' ... matched as AVOption 'tune' with argument
'zerolatency'.
Reading option 'udp://127.0.0.1:10000?pkt_size=1316&ttl=64' ... matched
as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument debug.
Applying option vstats (dump video coding statistics to file) with
argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file http://127.0.0.1/stream.m3u8.
Applying option muxpreload (set the initial demux-decode delay) with
argument 30.
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: http://127.0.0.1/stream.m3u8.
[hls,applehttp @ 021098c0] Format hls,applehttp probed with size=2048
and score=100
[AVIOContext @ 038a79e0] Statistics: 471 bytes read, 0 seeks
Format mpegts probed with size=2048 and score=100
[mpegts @ 02109dc0] stream=0 stream_type=1b pid=1f4 prog_reg_desc=
[mpegts @ 02109dc0] stream=1 stream_type=3 pid=2bc prog_reg_desc=
[mpegts @ 02109dc0] File position before avformat_find_stream_info() is
0
[mpegts @ 02109dc0] Continuity check failed for pid 0 expected 12 got 11
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749743401 in the queue
[h264 @ 0210a2e0] no picture
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749747001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749750601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749754201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749757801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749761401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749765001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749768601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749772201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749775801 in the queue
[mpegts @ 02109dc0] All info found
[mpegts @ 02109dc0] Estimating duration from bitrate, this may be
inaccurate
[mpegts @ 02109dc0] File position after avformat_find_stream_info() is
402132
[hls,applehttp @ 021098c0] File position before
avformat_find_stream_info() is 471
[hls,applehttp @ 021098c0] All info found
[hls,applehttp @ 021098c0] Estimating duration from bitrate, this may be
inaccurate
[hls,applehttp @ 021098c0] File position after
avformat_find_stream_info() is 471
Input #0, hls,applehttp, from 'http://127.0.0.1/stream.m3u8':
  Duration: 00:00:01.14, start: 30551.556456, bitrate: 3 kb/s
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0, 21, 1/90000: Video: h264 (High) ([27][0][0][0] /
0x001B), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/50, 25 fps, 50 tbr, 90k
t
bn, 50 tbc
    Stream #0:1, 26, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 48000
Hz, stereo, s16p, 320 kb/s
Successfully opened the file.
Parsing a group of options: output file
udp://127.0.0.1:10000?pkt_size=1316&ttl=64.
Applying option c:v (codec name) with argument mpeg2video.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option b:v (video bitrate (please use -b:v)) with argument
5000k.
Applying option c:a (codec name) with argument mp2.
Applying option ac (set number of audio channels) with argument 2.
Applying option b:a (video bitrate (please use -b:v)) with argument
256k.
Applying option ar (set audio sampling rate (in Hz)) with argument
48000.
Applying option copyinkf (copy initial non-keyframes) with argument 1.
Applying option metadata (add metadata) with argument
service_provider=TestProv.
Applying option metadata (add metadata) with argument
service_name=TestChannel.
Applying option streamid (set the value of an outfile streamid) with
argument 1:700.
Applying option f (force format) with argument mpegts.
Successfully parsed a group of options.
Opening an output file: udp://127.0.0.1:10000?pkt_size=1316&ttl=64.
Successfully opened the file.
[buffer @ 038b0180] Setting entry with key 'video_size' to value
'720x576'
[buffer @ 038b0180] Setting entry with key 'pix_fmt' to value '0'
[buffer @ 038b0180] Setting entry with key 'time_base' to value
'1/90000'
[buffer @ 038b0180] Setting entry with key 'pixel_aspect' to value
'16/15'
[buffer @ 038b0180] Setting entry with key 'sws_param' to value
'flags=2'
[buffer @ 038b0180] Setting entry with key 'frame_rate' to value '50/2'
[graph 0 input from stream 0:0 @ 0426ef60] w:720 h:576 pixfmt:yuv420p
tb:1/90000 fr:25/1 sar:16/15 sws_param:flags=2
[abuffer @ 040cdf40] Setting entry with key 'time_base' to value
'1/48000'
[abuffer @ 040cdf40] Setting entry with key 'sample_rate' to value
'48000'
[abuffer @ 040cdf40] Setting entry with key 'sample_fmt' to value 's16p'
[abuffer @ 040cdf40] Setting entry with key 'channel_layout' to value
'0x3'
[graph 1 input from stream 0:1 @ 0434df60] tb:1/48000 samplefmt:s16p
samplerate:48000 chlayout:0x3
[aformat @ 0210a760] Setting entry with key 'sample_fmts' to value 's16'
[aformat @ 0210a760] Setting entry with key 'sample_rates' to value
'48000'
[aformat @ 0210a760] Setting entry with key 'channel_layouts' to value
'0x3'
[audio format for output stream 0:1 @ 038a55e0] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and th
e filter 'audio format for output stream 0:1'
[auto-inserted resampler 0 @ 040ce820] ch:2 chl:stereo fmt:s16p
r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
[mpeg2video @ 04300240] detected 8 logical cores
[mpeg2video @ 04300240] intra_quant_bias = 96 inter_quant_bias = 0
[h264 @ 038e15c0] detected 8 logical cores
[mpegts @ 042ffd20] muxrate VBR, pcr every 2 pkts, sdt every 200,
pat/pmt every 40 pkts
Output #0, mpegts, to 'udp://127.0.0.1:10000?pkt_size=1316&ttl=64':
  Metadata:
    service_provider: TestProv
    service_name    : TestChannel
    encoder         : Lavf54.63.100
    Stream #0:0, 0, 1/90000: Video: mpeg2video (hq), yuv420p, 720x576
[SAR 16:15 DAR 4:3], 1/25, q=2-31, 5000 kb/s, 90k tbn, 25 tbc
    Stream #0:1, 0, 1/90000: Audio: mp2, 48000 Hz, stereo, s16, 256 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (mp2 -> mp2)
Press [q] to stop, [?] for help
[h264 @ 0434af20] Using externally provided dimensions
[h264 @ 042e4ce0] no picture
*** 28 dup!
*** 1 dup!9 fps= 17 q=2.5 size=      96kB time=00:00:01.04 bitrate=
757.8kbits/s dup=28 drop=0
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749779401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749783001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749786601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749790201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749793801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749797401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749801001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749804601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749808201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749811801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749815401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749819001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749822601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749826201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749829801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749833401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749837001 in the queue
first_dts 2749741601 not matching first dts 2749840601 in the
queue1131.1kbits/s dup=29 drop=0
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749844201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749847801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749851401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749855001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749858601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749862201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749865801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749869401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749873001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749876601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749880201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749883801 in the queue
first_dts 2749741601 not matching first dts 2749887401 in the
queue1528.0kbits/s dup=29 drop=0
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749891001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749894601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749898201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749901801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749905401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749909001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749912601 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749916201 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749919801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749923401 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749927001 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749930601 in the queue
first_dts 2749741601 not matching first dts 2749934201 in the
queue2073.1kbits/s dup=29 drop=0
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749937801 in the queue
[mpegts @ 02109dc0] first_dts 2749741601 not matching first dts
2749941401 in the queue
frame=   80 fps= 23 q=2.5 Lsize=    1212kB time=00:00:03.16
bitrate=3141.7kbits/s dup=29 drop=0
video:1042kB audio:70kB subtitle:0 global headers:0kB muxing overhead
8.966129%
[AVIOContext @ 0210b300] Statistics: 471 bytes read, 0 seeks
Received signal 2: terminating.

>> 2. HLS in the playlist starts to play with the predictions of the
last 
>> movie, and not from the beginning of the playlist.

>Please elaborate what you mean.

In this playlist:
#EXTM3U
#EXT-X-VERSION:2
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:40978

#EXT-X-KEY:METHOD=NONE

#EXTINF:5,
http://127.0.0.1/stream2013_2_25_9_16_16-40978.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_21-40979.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_27-40980.ts
#EXTINF:5,
http://127.0.0.1/stream2013_2_25_9_16_33-40981.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_38-40982.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_44-40983.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_50-40984.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_16_56-40985.ts
#EXTINF:5,
http://127.0.0.1/stream2013_2_25_9_17_2-40986.ts
#EXTINF:6,
http://127.0.0.1/stream2013_2_25_9_17_7-40987.ts


Playing started from http://127.0.0.1/stream2013_2_25_9_16_56-40985.ts,
but no from http://127.0.0.1/stream2013_2_25_9_16_16-40978.ts


>> 3. Bitrate jumps from 4000 to 6000.

>Maybe try x264 video encoder, it may be more flexible and developed.
>Maybe it will control bitrate more precisely.
>BTW -tune zerolatency is x264 encoder option, mpeg2video encoder does
not support it.

Broadcast operator need from MPEG2 from us.



More information about the ffmpeg-user mailing list