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

Moritz Barsnick barsnick at gmx.net
Tue Sep 10 12:41:08 EEST 2019

Hi Ben,

On Tue, Sep 10, 2019 at 06:09:30 +0100, Ben Houghton wrote:
> 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):

Are you saying that after a few frames the video becomes correct?

> HLS output distorted image <https://i.stack.imgur.com/Dxx03.png>
> MPEGDASH output distorted image <https://i.stack.imgur.com/9YQri.png>

This doesn't look like an encoding error by ffmpeg, but it could be a
decoding artifact. In particular if the first frame is not a keyframe
or just partially received. There's possibly nothing you can do,
because that's the way the stream is initially picked up. (Just
guessing so far.)

> 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?

To see what ffmpeg is doing with your input, it would have been helpful
to look at ffmpeg's complete log output. But:

> ffmpeg -re -y -loglevel error -hide_banner

Without "-loglevel error" and without "-hide_banner" please.

To see whether the input is at fault, you would strip all the output
magic and just dump a few seconds to file, by keeping all the input
options, but just writing a simple file, for example:

$ ffmpeg { input options } -map 0:v -map 1:a -t 5 testout.mp4

to check whether the same effects are to be seen in that file.

> ffmpeg version 3.4.6 Copyright (c) 2000-2019 the FFmpeg developers

Though it probably isn't part of your issue, we always recommend to
test (or even use) a very recent version of ffmpeg. This rules out
debugging fixed bugs. If you can't find a newer ffmpeg in some other
repository, and you don't want to build yourself, you can grab a static
binary from here and test with that:


(Left column, "git master", please.)


More information about the ffmpeg-user mailing list