[FFmpeg-user] Live stream out of sync & choppy video
Mitja Pirih
mitja at alternet.si
Thu Apr 14 15:49:10 CEST 2016
On 14. 04. 2016 15:24, Carl Eugen Hoyos wrote:
> Mitja Pirih <mitja <at> alternet.si> writes:
>
>> I am grabbing a live mpeg2 multicast stream from my provider and
>> creating a HLS x264 with AAC from it. Everything works great at least
>> for some time, after a certain period of time (i can't define the time
>> parameter it is random) it happens for audio and video to go out of sync
>> usually in 48 hours. Audio looks to work as expected without anomalies,
>> video gets choppy and out of sync with audio. Some video frames get
>> skipped as the video for a couple of seconds gets on fast forward, then
>> it stops and then plays again, but still out of sync. I suspect it
>> starts when anomalies on the source start. When I restart the stream it
>> just works.
>>
>> Any ideas? Should I provide you with a full ffmpeg output
>> or maybe you just know how to get rid of a problem?
> The FFmpeg command and the console output are always useful
> (and while unlikely it is not impossible that somebody
> knows what's going wrong) but I fear that you have to record
> the whole input (!) stream to allow us to reproduce.
>
>> I do have a video chunk if you need to check it out.
> Output files are very often useless but if you already
> have one...
>
> Carl Eugen
>
>
By record whole input you mean record the source until the problem starts?
Video chunk: https://www.dropbox.com/s/u8ns4p4pqfkn900/animal.zip?dl=0
Full console output:
/usr/bin/ffmpeg -i udp://@239.11.1.73:5000 -pix_fmt yuv420p
-filter_complex "[i:0x4b1]yadif=0:-1:0[base];[base][i:0x4ba]overlay[v]"
-map [v] -map i:0x4b2 -preset medium -c:a libfdk_aac -profile:a aac_he
-ac 2 -b:a 64k -ar 48000 -c:v libx264 -maxrate 1900k -bufsize 2850k
-vprofile high -hls_time 2 -hls_list_size 5 -use_localtime 1
-hls_segment_filename /var/www/hls/Animal+Planet-%Y%m%d-%s.ts
/var/www/hls/Animal+Planet.m3u8
ffmpeg version N-77547-g2893dbf Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --prefix=/home/mitja/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/mitja/ffmpeg_build/include
--extra-ldflags=-L/home/mitja/ffmpeg_build/lib --bindir=/home/mitja/bin
--enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-libspeex --enable-nonfree
libavutil 55. 11.100 / 55. 11.100
libavcodec 57. 20.100 / 57. 20.100
libavformat 57. 21.100 / 57. 21.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 22.100 / 6. 22.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[mpeg2video @ 0x3836140] Invalid frame dimensions 0x0.
Last message repeated 2 times
Input #0, mpegts, from 'udp://@239.11.1.73:5000':
Duration: N/A, start: 33788.762089, bitrate: N/A
Program 10902
Metadata:
service_name : Animal Planet
service_provider:
Stream #0:0[0x4b1]: Video: mpeg2video (Main) ([2][0][0][0] /
0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 6500 kb/s, 25
fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x4b2]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 128 kb/s
Stream #0:2[0x4b3]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 128 kb/s
Stream #0:3[0x4b4]: Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 128 kb/s
Stream #0:4[0x4ba](slv): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Stream #0:5[0x4bb](scc): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Stream #0:6[0x4bc](scr): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
[mpegts @ 0x38118c0] sub2video: using 720x576 canvas
[libx264 @ 0x399b520] using SAR=64/45
[libx264 @ 0x399b520] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x399b520] profile High, level 3.0
Output #0, hls, to '/var/www/hls/Animal+Planet.m3u8':
Metadata:
encoder : Lavf57.21.100
Stream #0:0: Video: h264 (libx264), yuv420p, 720x576 [SAR 64:45 DAR
16:9], q=-1--1, max. 1900 kb/s, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.20.100 libx264
Side data:
unknown side data type 10 (24 bytes)
Stream #0:1: Audio: aac (libfdk_aac) (HE-AAC), 48000 Hz, stereo,
s16, 64 kb/s
Metadata:
encoder : Lavc57.20.100 libfdk_aac
Stream mapping:
Stream #0:0 (mpeg2video) -> yadif (graph 0)
Stream #0:4 (dvbsub) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
frame= 246 fps= 48 q=-1.0 Lsize=N/A time=00:00:09.76 bitrate=N/A dup=12
drop=0 speed=1.89x
video:862kB audio:77kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
[libx264 @ 0x399b520] frame I:6 Avg QP:20.85 size: 17962
[libx264 @ 0x399b520] frame P:133 Avg QP:23.95 size: 4645
[libx264 @ 0x399b520] frame B:107 Avg QP:26.13 size: 1464
[libx264 @ 0x399b520] consecutive B-frames: 34.1% 21.1% 7.3% 37.4%
[libx264 @ 0x399b520] mb I I16..4: 19.1% 74.5% 6.3%
[libx264 @ 0x399b520] mb P I16..4: 7.9% 9.7% 0.6% P16..4: 38.7%
8.2% 3.1% 0.0% 0.0% skip:31.9%
[libx264 @ 0x399b520] mb B I16..4: 0.2% 0.4% 0.0% B16..8: 30.1%
2.6% 0.4% direct: 0.8% skip:65.5% L0:44.0% L1:51.8% BI: 4.1%
[libx264 @ 0x399b520] 8x8 transform intra:57.8% inter:88.7%
[libx264 @ 0x399b520] coded y,uvDC,uvAC intra: 37.2% 52.5% 13.7% inter:
10.5% 16.1% 0.4%
[libx264 @ 0x399b520] i16 v,h,dc,p: 52% 12% 6% 30%
[libx264 @ 0x399b520] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 12% 22% 3%
3% 6% 3% 6% 3%
[libx264 @ 0x399b520] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 13% 11% 4%
5% 9% 4% 5% 2%
[libx264 @ 0x399b520] i8c dc,h,v,p: 48% 13% 35% 5%
[libx264 @ 0x399b520] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x399b520] ref P L0: 67.8% 13.8% 13.1% 5.3%
[libx264 @ 0x399b520] ref B L0: 85.8% 11.7% 2.5%
[libx264 @ 0x399b520] ref B L1: 95.9% 4.1%
[libx264 @ 0x399b520] kb/s:717.28
Exiting normally, received signal 2.
More information about the ffmpeg-user
mailing list