popcornmix / omxplayer

omxplayer
GNU General Public License v2.0
1.01k stars 334 forks source link

Distortion with streaming #804

Closed jayavanth closed 2 years ago

jayavanth commented 2 years ago

I'm trying to play 1080p 30fps videos on Raspberry Pi Zero W and I can play that on omxplayer locally totally fine. I can even play up to 1080p 60fps with no issues.

But I have been trying to stream 1080p 30fps videos to Pi Zero and I end up with green artifacts and horizontal lines like in these pictures: https://imgur.com/a/DIYHtRs

Here's what I'm running:

  1. streaming computer

    ffmpeg -re -i bbb_sunflower_1080p_30fps_normal.mp4  -c:v copy -c:a copy -f mpegts udp://192.168.1.143:8888

    Basically just copying h264 and mp3 frames over to the Pi

  2. Pi Zero W

    omxplayer udp://@:8888

I initially thought this was because of buffering so I added some buffering on the ffmpeg side and that didn't work. Then, I added buffering on the omx side with --threshold n where I tried n values from 1-20 seconds. Since omxplayer can play local files it should play buffered video the same way, right?

What worked:

I was able to stream 1080p 25fps with a bitrate of 4733 kb/s with no problem. But with 5571 kb/s I saw some green artifacts pop up.

I understand that omxplayer is deprecated but the performance of vlc/mplayer/mpv are even worse on the Pi Zero. Do you know what might be going wrong with streaming vs local file play? Are there any other softwares you think I should look at for playing the stream on the Pi?

popcornmix commented 2 years ago

upd is a lossy protocol - packets can be lost and won't be re-transmitted. If you are using wifi then that sort of corruption is common. You can get lost packets on wired ethernet, but it's less common.

jayavanth commented 2 years ago

Thanks! That was very helpful. I switched to TCP and it's working flawlessly