[FFmpeg-user] Video output distortion on ffpmeg live stream

Ben Houghton ben at ivent-hq.com
Tue Sep 10 08:09:30 EEST 2019


I am helping build a node server that runs ffmpeg to stream a live WebRTC input to HLS and MPEGDASH. Often when the encoding starts it produces a corrupted video output that looks something like this (viewed using VLC):

HLS output distorted image <https://i.stack.imgur.com/Dxx03.png>
MPEGDASH output distorted image <https://i.stack.imgur.com/9YQri.png>
It isn't doing this every time, but roughly 50%.

The ffmpeg commands being run are:

ffmpeg -re -y -loglevel error -hide_banner -threads 1 -use_wallclock_as_timestamps 1 -f rawvideo -pix_fmt yuv420p -s 640x480 -framerate 30.000030517578125 -thread_queue_size 512 -i tcp://127.0.0.1:43713 -thread_queue_size 512 -i tcp://127.0.0.1:41871 -vsync 1 -r 30.000030517578125 -c:a aac -c:v h264 -profile:v high -b_strategy 0 -bf 1 -f dash -use_template 1 -use_timeline 1 -window_size 5 -live 1 -min_seg_duration 2000000 -preset veryfast -crf 22 -g 48 -keyint_min 48 -sc_threshold 0 -filter_complex [0]format=pix_fmts=yuv420p[temp0];[temp0]scale=-2:240[A0] -map [A0]:v -b:v:0 400k -maxrate 428k -bufsize 600k -map 1:a -b:a:0 64k -filter_complex [0]format=pix_fmts=yuv420p[temp1];[temp1]scale=-2:360[A1] -map [A1]:v -b:v:1 700k -maxrate 749k -bufsize 1050k -map 1:a -b:a:1 96k /usr/src/app/cdn-path/webrtc_test.mpd

ffmpeg -re -y -loglevel error -hide_banner -threads 1 -use_wallclock_as_timestamps 1 -f rawvideo -pix_fmt yuv420p -s 640x480 -framerate 30.000030517578125 -thread_queue_size 512 -i tcp://127.0.0.1:43713 -thread_queue_size 512 -i tcp://127.0.0.1:41871 -vsync 1 -r 30.000030517578125 -c:a copy -c:v h264 -profile:v high -b_strategy 0 -bf 1 -f mpegts /usr/src/app/cdn-stream-save/webrtc_test_1567437442625.ts -c:a aac -c:v h264 -profile:v high -b_strategy 0 -bf 1 -f hls -hls_time 2 -hls_list_size 5 -hls_flags delete_segments -preset veryfast -crf 22 -g 48 -keyint_min 48 -sc_threshold 0 -filter_complex [0]format=pix_fmts=yuv420p[temp0];[temp0]scale=-2:240[A0] -map [A0]:v -b:v:0 400k -maxrate 428k -bufsize 600k -map 1:a -b:a 64k /usr/src/app/cdn-path/webrtc_test_1.m3u8 -hls_time 2 -hls_list_size 5 -hls_flags delete_segments -preset veryfast -crf 22 -g 48 -keyint_min 48 -sc_threshold 0 -filter_complex [0]format=pix_fmts=yuv420p[temp1];[temp1]scale=-2:360[A1] -map [A1]:v -b:v:1 700k -maxrate 749k -bufsize 1050k -map 1:a -b:a 96k /usr/src/app/cdn-path/webrtc_test_2.m3u8
ffmpeg details:

ffmpeg version 3.4.6 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100

Does anyone have any ideas on what might cause this type of distortion on the output stream or how I can test further to track it down?

Thank you


More information about the ffmpeg-user mailing list