mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.81k stars 2.87k forks source link

video artefacts when watching TV streams containing a videotext channel #3318

Closed sfrieske closed 1 year ago

sfrieske commented 8 years ago

mp version

0.18 on Linux

Reproduction steps

open a tv stream: mpv rtp://@239.35.10.1:10000

Expected behavior

clean audio and video

Actual behavior

clean start but video starts showing huge artefacts after a few seconds. Audio and video are still in sync, video has huge areas that look like "frozen", i.e. washed out colors that are changing slowly. After a while (next sync?) the video gets towards normal but it starts over.

The root cause seems to be in ffmpeg, that shows the same behavior. However, if passing "-sn" (subtitles no) to ffplay the video output is as expected. Passing --sid=no to mpv does not have the same effect, the video output is still corrupt.

Log output

(+) Video --vid=1 (h264) Audio --aid=1 --alang=deu (ac3) (+) Audio --aid=2 --alang=deu (mp2) Subs --sid=1 --slang=deu (dvb_teletext) AO: [alsa] 48000Hz stereo 2ch s16 [ffmpeg/video] h264: co located POCs unavailable [ffmpeg/video] h264: mmco: unref short failure -----> the one below seems to be the culprit [ffmpeg/video] h264: number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one [ffmpeg/video] h264: cabac decode of qscale diff failed at 27 26 [ffmpeg/video] h264: error while decoding MB 27 26, bytestream 42060 [ffmpeg/video] h264: mmco: unref short failure

ghost commented 8 years ago

Do you have a dump of the h264 stream? I doubt -sn in ffplay actually fixes it.

sfrieske commented 8 years ago

Just open the stream: mpv rtp://@239.35.10.1:10000 It's a public tv stream and the effect is always seen. And, btw. never occurs with ffplay -sn.

ghost commented 8 years ago

Just open the stream: mpv rtp://@239.35.10.1:10000

Never opens here.

olifre commented 8 years ago

Never opens here.

From quick googling, this is German IPTV which you only get "for free" if subscribing to Telekom Entertain. I certainly do not see such artifacts for German TV stations via DVB-S (even if a dvb_teletext stream is also present there). I'm also not a subscriber to IPTV, so I guess a dump is needed...

sfrieske commented 8 years ago

No need to subscibe, it is free. Maybe not visible outside of Germany? How exactly do I create the dump?

ghost commented 8 years ago

Use ffmpeg codec copy.

olifre commented 8 years ago

No need to subscibe, it is free. Maybe not visible outside of Germany?

I disagree - I live in Germany and can neither access it from home (using Inexio, a German provider which is not reselling from the Deutsche Telekom) nor from work (a DFN connection, i.e. from the "Deutsches Forschungsnetz"). So you at least need to have a Telekom connection (or one from a reseller) to access this, even in Germany - probably this Entertain-stuff is just in any such contract by default now.

ghost commented 8 years ago

I think i'm having the same / a similar issue here - trying to playback rtp streams in-house (created by a dvb-s headend) gives me strange artifacts.

Using VLC to create a rtp stream i get those same artifacts aswell.

To provide a stream to play: vlc -I dummy --sout '#rtp{dst=239.0.0.5,port=12345,mux=ts}' --sout-all --sout-keep

artifacts: mpv rtp://@239.0.0.5:12345 no artifacts: ffplay rtp://@239.0.0.5:12345 no artifacts: ffmpeg -i rtp://@239.0.0.5:12345 -c copy -f mpegts -|mpv -

As video files i used a 5mb big buck bunny.mp4 aswell as a mpeg-ts stream dump which i can provide (around 20MB)

Using mpv directly to play those files (or the mpegts stream dump) works well

Versions used: VLC media player 3.0.0-git Vetinari (revision 2b82c9f) ffmpeg version 3.0.2 mpv 0.18.1 (on fedora 24)

@ssteidte ffmpeg -i rtp://@239.35.10.1:10000 -c copy -f mpegts stream.dump

sfrieske commented 8 years ago

Thanks, tac07! Uploaded the dump file: https://drive.google.com/file/d/0B07wA6KwGyq6QUlQTUN5VVFuNG8/view?usp=sharing

The weird artefacts are less impressive than in the rtsp stream, but after a few seconds they show up.

I'm happy that somebody else sees the same issue. Playing with ffmpeg and a pipe to mpv I got theses results: heavy artifacts: mpv rtp://@239.35.10.1:10000 much less artifacts: ffplay rtp://@239.35.10.1:10000 no artifacts: ffplay -sn -err_detect ignore_err rtp://@239.35.10.1:10000 almost no artifacts: ffmpeg -sn -err_detect ignore_err -c copy -f mpegts - | mpv -

If there were a way to pass the options from mpv directly on to ffplay - that might be the solution for mpv.

ghost commented 7 years ago

Seems to be fixed for me since one of the last few patches.

sfrieske commented 7 years ago

Much better, but not yet as smooth as with the ffplay pipe :( It looks like ffmpeg '-err_detect ignore_err' does something magic with several decoding errors to the effect that a human does not perceive these errors.

ghost commented 7 years ago

So set that option via --vd-lavc-o

sfrieske commented 7 years ago

Tryed it before I wrote the last post (and now once more), the experience is not the same.

aomader commented 7 years ago

Not sure if this is related by when I try to play e.g. rtp://87.141.215.251@232.0.20.234:10000 (which is ZDF HD and works in VLC), simply nothing happens. Any hints?

CounterPillow commented 7 years ago

Not sure if this is related

it most likely isn't

and works in VLC

I've just tried it and it does not for me.

olifre commented 7 years ago

I've just tried it and it does not for me.

Same problem here, doesn't work neither with vlc nor mpv. However, ZDF via HLS works: https://zdf1314-lh.akamaihd.net/i/de14_v1@392878/master.m3u8 URL found at: https://wiki.ubuntuusers.de/Internet-TV/Stationen/

aomader commented 7 years ago

You need to be a customer of the Telekom and their EntertainTV product in order to use this stream. But as I said, it does work in VLC and not in mpv. What could I do in order to help debug this issue?

olifre commented 7 years ago

You need to be a customer of the Telekom and their EntertainTV product in order to use this stream.

Ok, that explains why none of us can reproduce it to work with VLC... Just a guess: Could you check what happens if you have VLC running, playing back this stream, and then start mpv in parallel (for the very same stream)? In case it's some multicast-issue, this may change things.

sfrieske commented 7 years ago

Just tried it, this doesn't help. The stream has besides the video and audio channels typically 2 more channels: Teletext and EPG. It looks like mpv is choking on one of them - producing nasty video artefacts -, resyncs (which gives good video for ~ 3 seconds) and chokes again. What does work well is to either use ffplay or ffmpeg with the output piped to mpv. In summary (see the posts neaer the top) ffmpeg and vlc seem to have options to handle the "choking" (more) gracefully with respect to the video output.

aomader commented 7 years ago

@ssteidte: I tried all the commands above, but none worked. However, I have not tried starting VLC before hand to solve potential multicast issues. Will try this later.

aomader commented 7 years ago

A short follow up:

When I run VLC in the background, I get some results using the above mentioned stream.

For mpv, it takes some time but than video is shown. No audio though and there are some visual glitches from time to time:

% mpv 'rtp://87.141.215.251@232.0.20.234:10000' 
Resuming playback. This behavior can be disabled with --no-resume-playback.
Loading config '/home/oli/.config/mpv/watch_later/1D7C454889175435A1A73DFC1CA59CD3'
Playing: rtp://87.141.215.251@232.0.20.234:10000
[ffmpeg/video] h264: SPS unavailable in decode_picture_timing
[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: SPS unavailable in decode_picture_timing
[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: decode_slice_header error
[ffmpeg/video] h264: no frame!
[ffmpeg/video] h264: SPS unavailable in decode_picture_timing
[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: SPS unavailable in decode_picture_timing
[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: decode_slice_header error
[ffmpeg/video] h264: no frame!
(A LOT MORE OF THOSE ABOVE)
[ffmpeg/video] h264: mmco: unref short failure
[ffmpeg/demuxer] mpegts: Could not find codec parameters for stream 4 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' and 'probesize' options
 (+) Video --vid=1 (h264 1280x720 50.000fps)
 (+) Audio --aid=1 --alang=deu (ac3 2ch 48000Hz)
     Audio --aid=2 --alang=deu (mp2 2ch 48000Hz)
     Subs  --sid=1 --slang=deu (dvb_teletext)
AO: [pulse] 48000Hz stereo 2ch float
[ffmpeg/video] h264: co located POCs unavailable
[ffmpeg/video] h264: mmco: unref short failure
[ffmpeg/video] h264: number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[ffmpeg/video] h264: co located POCs unavailable
VO: [opengl] 1280x720 yuv420p
AV: 00:00:22 A-V:  0.000 Cache:  3s+0KB
Not seekable - not saving state.

The command ffmpeg -i 'rtp://87.141.215.251@232.0.20.234:10000' -c copy -f mpegts -|mpv - works. Though there is no sound and there are video glitches. See the log for more information.

ffplay rtp://87.141.215.251@232.0.20.234:10000 also works, audio included, but there are also some visual glitches. See again the log.

When VLC doesn't run in the background playing the stream, simply nothing happens.

derflasher commented 5 years ago

This problem still exists in Version 0.29.1 . Does anyone has a quick workaround?