[SCRIPT] Batch convert YUV 4:4:4 videos to YUV 4:2:0 in Retropie/Linux
-
@Gogol Are you using WinScp as the
root
? It's not advisable and it's probably the cause of this error. Before runningchmod
, run:sudo chown pi 444p-to-420p.sh
-
@Gogol If @mitu's tip doesn't help, please show us the output of
ls -l 444p-to-420.sh
to see the owner and permissions of the file. Both "
l
" are small "L" and not ones.As a side note, if you save the file in
/home/pi/bin
you can invoke it from any other directory without writing its full path (/home/pi/444p-to-420p.sh
in your case), i.e. from your videos directory. See my Hint in my opening post.From your current location of the file, these commands will to that:
cd /home/pi # make sure you are in pi's home directory mkdir bin # create the directory "bin" mv 444p-to-420p.sh bin # move the script to bin
-
Hi, sorry for the late reply.
I was not able to get this to work, but I think the problem lies with the .mp4 videos I am trying to convert, I downloaded them from the internet from sites like emumovies and arcadepunks.
They do not display on the preview, so I tried converting one of the video snaps via VLC Media Player and was able to get the video to display in emulation station, however it was extremely glitchy. I have also tried with handbrake but with no success, the video does not display.
Do you know of another way to convert these videos, or possibly the correct settings in VLC or handbrake to get the videos to display without any glitches?
-
@Gogol I converted most problematic videos by completely recoding with Avidemux on my Ubuntu pc. That was before I saw this script. I don't remember the exact settings:
- Video Codec=Mpeg4 AVC (x264)
- change quality setting to something like 26 or so (really don't know anymore)
- Audio Codec=AAC or MP3, not sure
- Output Format=MP4v2 Muxer
-
@thelostsoul I tried Avidemux for Windows with those settings but was unsuccessful in getting them to work.
I do not want to derail this thread and I could not find a PM function, so I wanted to ask if you would be willing to convert the eight .mp4 video snaps I have using the batch converter created by Clyde if I sent them to you, to test if they work after conversion and then send them back to me if they do?
-
@Gogol You are right. Create a new thread and use my nickname so I get ping. Upload the files all at once in a zip file to https://uploadfiles.io/ and I try.
-
Just came across this and it worked like a champ for me. Thanks!
-
thank you also. My .mp4's werent named -video.mp4 so I whipped that out and the script has run perfectly. thanks!
-
hello everyone, I'm using Retropie 4.6 right now, and I encountered lots of scrapped videos that only had sound but no display in ES, with OMX player on or off.
I'm sorry, but aren't we all taking the wrong way to find a solution? The short term solution is to convert the videos, but the long term solution is to be able to play them as is, without converting. What other distribs (Batocera, Recalbox, Regamebox) do that Retropie doesn't? Why all these videos do play on other images and not on Retropie?
I got some scrapped romsets and I had to convert all videos, but when I spoke to the authors they said (what? They do play perfectly with our images.... update Retropie, we're using VLC behind the scenes, there is no problem....)So... what would be the solution to play these videos WITHOUT converting?
-
@toto2000 said in [SCRIPT] Batch convert YUV 4:4:4 videos to YUV 4:2:0 in Retropie/Linux:
So... what would be the solution to play these videos WITHOUT converting?
You could switch from OMX player to VLC by disabling the option "Other Settings" > "Use OMX Player (HW Accelerated)" in Emulation Station. VLC should be able to play almost any video format you throw at it, but it is slower than OMX on Raspberry Pis.
-
@Clyde no, it doesn't change anything. I tried to switch this option off in ES Menu, and the video have sound but do not display at all + I also tried to restart ES. Nothing seems to have an effect on these videos.
Here is such a video: https://mega.nz/file/DhRyGYiJ#O_HlRb3Dptb-NW-ZyW9GQPdVl8I_VRhlwI0bPx2KkJs -
Yeah well, this video is in the aforementioned
yuv444
format, and as I learned recently, VLC now shares some limitations of OMX because its now also hardware accelerated.So on a Pi, you may only have the option to convert the videos to yuv420.
-
Thank you for this, Clyde. I've been pulling my hair out for days trying to figure out what I have done wrong scraping video snaps from the ArcadeItalia DB. It seems insane that the video player in ES can't be updated to play 4:4:4 video by default, or that there's no 'official' documentation for this at least.
-
Update 4:
- Removed "-video" suffix to support videos without it, e.g. those scraped with Skyscraper.
- Added quotation marks to the variable
$f
to support file names with spaces and special characters. - Added a simple progress indicator by showing the currently checked file's path and name in the console.
- Moved the update history here to declutter the opening post.
Update 3: Changed avprobe to ffprobe and avconv to ffmpeg for compatibility with Debian Buster and above, which doesn't have the transitional package
libav-tools
anymore . See Update #1.Update 2: Deleted some outdated lines and edit: remarks.
Update 1: From Retropie 4.4 on, avprobe was replaced by ffprobe, and avconv was replaced by ffmpeg. But at least in RP 4.4, the old designations are still usable, and so is the script.
-
@clyde hello, I hate to do this but Iām completely new to this. Is there a way to summarize the steps to follow in a way that a kid would understand it? Iām reading all the posts and I get the idea but not sure how to implement it. I am working with a keyboard connected to my raspberry pi 3B and I can hear the sound of my videos but there is no picture. Can I fix them directly on raspberry pi or do I need to connect to a terminal? Can I fix them all at once or I have to fix one by one? Thank you and sorry for so many questions.
-
@colombia20102018 Well, my opening post already includes a summary of the few steps you have to take:
Just save the script into a text file (e.g. 444p-to-420p.sh), make it executable with the command chmod u+x 444p-to-420p.sh, and run it from within your videos directory.
You can do that either a) directly on your Pi with a keyboard attached or b) via network using SSH (see the Docs about that).
- a) Press
F4
in Emulation Station, or b) connect via SSH. - Create the directory
bin
to store the conversion script with this command:mkdir -p ~/bin
- Create the script file with
nano ~/bin/444p-to-420p.sh
, enter or paste the script's text, and exit nano by pressingCtrl+x
,y
, andEnter
one after another. - Back in the command line, make the script executable with
chmod u+x ~/bin/444p-to-420p.sh
- Navigate to your videos directory, e.g. RetroPie/roms/arcade/images:
cd ~/RetroPie/roms/arcade/images
- Run the script:
444p-to-420p.sh
Steps 2-4 only have to be done once.
After that, you'll find any converted videos in RetroPie/roms/arcade/images/converted. Continue as stated in my opening post:
After the conversion, you should test the videos in converted before finally moving them up one directory level to replace their 444p originals.
In my example, you would do the latter with this command:
mv ~/RetroPie/roms/arcade/images/converted/* RetroPie/roms/arcade/images
Be careful though, as this command will overwrite the originals irrevocably without asking for confirmation. Always make backups before doing anything potentially harmful to your files. ā ļø
Feel free to ask away if you encounter any problems.
- a) Press
-
Update 5:
- Added a link to this post with step-by-step instructions. Thanks to @Colombia20102018 for the suggestion.
Update 4:
- Removed "-video" suffix to support videos without it, e.g. those scraped with Skyscraper.
- Added quotation marks to the variable
$f
to support file names with spaces and special characters. - Added a simple progress indicator by showing the currently checked file's path and name in the console.
- Moved the update history here to declutter the opening post.
Update 3: Changed avprobe to ffprobe and avconv to ffmpeg for compatibility with Debian Buster and above, which doesn't have the transitional package
libav-tools
anymore . See Update #1.Update 2: Deleted some outdated lines and edit: remarks.
Update 1: From Retropie 4.4 on, avprobe was replaced by ffprobe, and avconv was replaced by ffmpeg. But at least in RP 4.4, the old designations are still usable, and so is the script.
-
@clyde thank you for the quick and detailed response. I completed steps 1 to 4 without any issues. I get confused with steps 5 and 6. Do I have to exit the GNU nano 3.2 to navigate to my videos directory or I do it right there? How do I exit the nano? I typed the cd command as instructed hit enter. Then I typed 444p-to-420p.sh and hit enter but nothing happened. Is that how I run the command? After done I guess I have to follow steps 5 to 6 for each emulator?
Sorry I am a complete newbie on this. -
@colombia20102018 Sorry, I forgot to mention: You can exit nano with
Ctrl+X
,y
andEnter
.What do you mean by "nothing happened"? Was there any output?
-
@clyde do I need to do steps 5 and 6 inside nano? How do I run the script? What do I type before the 444?
Thank you for explaining how to exit nano
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.