Viewing .avi videos on Buster

Aug 02, 2022 Last reply: 3 years ago 36 Replies

Here, it's a separate binary of slightly different size to ffmpeg/ffplay etc. but I wouldn't be surprised to find at some point a change was made to put all the stuff into one binary and just have symlinks for compatibility reasons.

In 3.2.14 there are separate source files for ffmpeg.c and ffprobe.c that yield separate binaries ... can't vouch for newer.

Is there any chance that a video editor on RasPiOS would be able to help with the problem of browsers not displaying ffmpeg's .mp4 files?

Apt search finds openshot-qt, are there better choices?

Thanks for reading,

bob prohaska

One thing of note is an unsual pixel format of "yuvj422p". Converting between pixel formats isn't something that I remember needing to do in the past, but you can use the "-pix_fmt" option with ffmpeg to convert the original video to another pixel format during the conversion. Available formats are listed with "ffmpeg -pix_fmts". A search for '"yuvj422p" VLC' picked up this thread which suggests using "-pix_fmt yuv420p" with ffmpeg to solve a very similar issue with VLC on a Raspberry Pi:

formatting link

Ah, good one. I'm afraid I'm not familar with pixel formats so I didn't see that. I should have, though, if I had compared this output to the format of a known good file.

Ive not found openshot much good at reading 'odd' movie formats but HandBrake usually does and renders them into 'pretty much anyone can read it' files.

Try both, as well as VLC Together with ffmpeg thats about the whole emergency toolkit!

The github issue was resolved nearly two years ago, at least so far as VLC player is concered. Sudo apt update/grade has been run many times since then. Is it possible I've still got a stale vlc player on the system? But, vlc play isn't important:

Since browsers are widely-used for viewing content I imagine that converting video files to browser-compatible formats is a rather common activity. In my case I want to convert a locally-recorded video file into a format that can be viewed on-line by somebody halfway around the world. Surely making it easy for them is a solved problem....no?

Thanks for writing!

bob prohaska

The thread/issue was very long so I skimmed and word-searched my way through because I don't have time to spend hours reading this stuff, however the impression I got was that many of the participants were quite confused and the idea that it had really been solved when it was marked as such didn't sound convincing to me. I would have thought that your posts are just more evidence of that.

The root of the issue seems to be a Pi-specific one to do with the hardware video decoding. At one point it's suggested that "--codec FFmpeg" is passed to VLC on the command line so that hardware acceleration is turned off, but it sounds like that turned out to be buggy in other ways.

I've heard about hardware acceleration being used with web browsers for video playback (though I never play video in browsers on any platform myself), so they're probably getting stuck at the same bug. But it should only be a problem on the Raspberry Pi, not other platforms. If you convert the video with ffmpeg into a different pixel format then it shouldn't be a problem anywhere.

What are you talking about? I just told you how to solve the problem. You were happy before to convert the video with: ffmpeg -i MVI_0001.AVI -r 24 2nd_home_screen.mp4

This time just do: ffmpeg -i MVI_0001.AVI -pix_fmt yuv420p -r 24 2nd_home_screen.mp4

and it should play in VLC on the Pi.

Actually you probably didn't really need 24fps, so just: ffmpeg -i MVI_0001.AVI -pix_fmt yuv420p 2nd_home_screen.mp4

Plus try playing the original video in VLC on PC if you're curious whether it's the same problem that's discussed at GitHub. But it's academic unless you want to go and report the bug.

Well, -pix_fmt yuv420p solved all the problems. A video created using ffmpeg -i MVI_0002.AVI -r 30 -pix_fmt yuv420p output.mp4 displays correctly using firefox, chrome and vlc player.

Thank you _very_ much!

bob prohaska

On a sunny day (Thu, 4 Aug 2022 22:37:13 -0000 (UTC)) it happened bob prohaska snipped-for-privacy@www.zefox.net> wrote in <tchhmo$2u268$ snipped-for-privacy@dont-email.me:

These script I have used to put my A470 videos on youtube with subtitles. All browsers I have play those. I do not know if youtube chaged anything to the format.

I never use VLC as it does not even run as root, neither do I use that raspi mediaplayer that has silly error messages and plays basically nothing

## canon A470 320x240 20fps AVI conversion to youtube divx4 320x240

echo "Usage: canon_to_youtube file.avi file.ppml"

#ffmpeg -i $1 -f wav q0.wav #ffmpeg -i $1 -f yuv4mpegpipe -b 5000 -vcodec pgmyuv -y q1.yuv

#sox q0.wav -r 44100 q1.wav resample

transcode -f 30 -g 320x240 -i q1.yuv -p q1.wav -R1 -w 350 \

-J subtitler="anti_alias font_factor=.75 font_size=14 color_depth=32 frame_offset=0 subtitle_file=$2 show_output=1" \

-x yuv4mpeg -y divx4 -o $1.avi -V -k

transcode -f 30 -g 320x240 -i q1.yuv -p q1.wav -R2 -w 350 \

-J subtitler="anti_alias font_factor=.75 font_size=14 color_depth=32 frame_offset=0 subtitle_file=$2 show_output=1" \

-x yuv4mpeg -y divx4 -o $1.avi -V -k

----- so adds subtitles from a .ppml file

panteltje20: ~ # ls /usr/local/sbin/canon_a470_to_youtube

-rwxr-xr-x 1 root root 683 Jan 15 2012 /usr/local/sbin/canon_a470_to_youtube*

hehe 2012, you need to install 'transcode', I run it on this x86 laptop

'subtitler' I wrote and is somewhere on my site panteltje.com

There are a million ways I suppose to do these things...

I just write stuff when I need it.

formatting link
formatting link

Subtitles is nice on youtube to show what's happening each moment.

Anyways mplayer and ffmpeg is likely more today's way for raspi users.

Isn't MJPEG the DVD-format? The one that at least early pi's needed a license for?

Hmm, I somehow only saw the first 5 replies to the thread. Now I see many more and that is was resolved. Sorry for the noise

You're thinking of MPEG2.

FWIW, it turns out openshot, which is in the apt repository, converts .avi files that aren't browser-viewable into mp4 files that play just fine in the chrome browser.

Thanks for everyone's help!

bob prohaska

I bet that's just an ffmpeg wrapper. Which is fine, if it works.

Possibly. I equip myself with VLC, Openshot and Handbrake which between them seem able to cope with everything so far thrown at them. VLC is distinctly not the same codecs as the others.

Actually they all depend on the FFmpeg project's libavcodec library.

formatting link
VLC and Handbrake (not sure about Openshot) can be built against other codec-specific libraries as well, like FFmpeg itself can too. The differences in use probably come down to which library the software decides to use, including in the case of this thread, one that uses (apparantly incorrectly) the video decoder built into the GPU. Ideally the decoder selection could be controlled at run-time, but in the case of forcing use of the FFmpeg codec over hardware acceleration in the RPi OS version of VLC, that was apparantly buggy at one point, so you'd probably have to recompile VLC.

It could also be that there are bugs in the way the programs use the libavcodec library. Or in this case Openshot obviously changes the pixel format by default, whereas FFmpeg doesn't, so that's just a design choice. They may both be using the same FFmpeg codecs though, as might VLC if it's not built with hardware acceleration enabled.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required