KenMk
Posts: 5
Joined: Tue Mar 28, 2023 2:48 pm

Play mp4 video on Pi3/4 without stuttering

Tue Feb 27, 2024 12:59 pm

I have a video produced in mp4 format from an audio-visual program. This runs perfectly from a Pi 3B on a small web server I created that machine when accessing using Firefox in both Windows 10 and Mint Cimmamon 21.2. Trying to play this same video on that Pi 3B or another Pi 3B or Pi4 just produces very stuttery video when using VLC on those machines.

I have tried changing the Video Output type in VLC's Preferences without any success in playback.

Any suggestions?

User avatar
neilgl
Posts: 7806
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Play mp4 video on Pi3/4 without stuttering

Tue Feb 27, 2024 1:19 pm

What is the encoding format of the video in the mp4?
"changing the Video Output type in VLC's Preferences" - are you re-encoding it?
Maybe try it with the well known Big Buck Bunny mp4 Codec? - H.264 - MPEG-4 AVC (part 10) (avc1)

KenMk
Posts: 5
Joined: Tue Mar 28, 2023 2:48 pm

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 12:45 pm

The video codec is H264, which I understand should play fine. Googling suggested changing, in VLC Tools>PreferencesVideo, the Output version. I don't think this does any re-encoding.
I have tried all of those Output options - as suggested in the post I found - but none of them produce a smooth output in VLC on the any of the Pi's.
Asd a sanity check I have just copied across the file to a laptop running Mint Cinnamon and tried to play it there. It opens VLC and plays it smoothly without any problems.
The problem seems to be linked to VLC on the Pi's, which I really don't understand!

User avatar
neilgl
Posts: 7806
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 1:09 pm

Yes, but have you tested VLC on the Pi with the widely used test video "Big Buck Bunny.mp4" etc.

KenMk
Posts: 5
Joined: Tue Mar 28, 2023 2:48 pm

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 4:31 pm

I have now and this video is still stuttering on all the Pi's.

User avatar
neilgl
Posts: 7806
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 5:13 pm

Which "Big Buck Bunny.mp4" did you get - I can compare it with mine.

KenMk
Posts: 5
Joined: Tue Mar 28, 2023 2:48 pm

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 5:20 pm

Finally found the problem, and to me it is a strange one.

Only one of the three Pi's has a screen attached, an old P3B+. This is actually playing all the videos perfectly well. The problem was actually my testing.

I have all of the machines connected over a local network, two via ethernet and one wireless. They all showed the same stuttering so I assumed it was the Pi's with problems. It would seem that, for some strange reason I can't fathom, the VNC link to each of them can't cope with the frame rate. It isn't the network itself, as all videos play perfectly directly over the network to the controlling Windows box or to the Linux laptop.

Sorry for the hassle, but maybe a lesson learned!!??

User avatar
neilgl
Posts: 7806
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 5:53 pm

When using VLC to view videos, I do this (not used yet in Bookworm)

Code: Select all

sudo nano /boot/cmdline.txt
video=HDMI-A-1:1920x1080@60D

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 16101
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Play mp4 video on Pi3/4 without stuttering

Wed Feb 28, 2024 6:00 pm

VNC is hideously inefficient as a system - expect compromises.

The Pi display hardware is quite capable of composing a number of layers directly to the HDMI (or DSI/DPI/VEC) outputs. VNC needs to see that composed scene, so forces a number of things back to software. It then has to encode the frame to reduce the bandwidth required from about 380Mbytes/sec to <10Mbit/s, all done in software.

So you've added a huge CPU load to the Pi to allow remote viewing. It's not surprising that the system glitches, typically by dropping frames on the VNC link.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
neilgl
Posts: 7806
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Play mp4 video on Pi3/4 without stuttering

Thu Feb 29, 2024 2:48 pm

Yes I never actually watch videos over VNC...

Return to “Troubleshooting”