RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [SCRIPT] RetroPie Convert Videos

    Scheduled Pinned Locked Moved Projects and Themes
    conversionomxscriptvideoyuv
    133 Posts 29 Posters 36.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ClydeC
      Clyde @Menion
      last edited by

      @Menion I would be very much inclined to help you, but my bash skills are extremely limited, too. My video conversion script is an example of the maximum level of my bash knowledge, and even for that I had to do some web research. Maybe @hiulit can give you some clues.

      1 Reply Last reply Reply Quote 0
      • M
        Menion
        last edited by

        No problem. Meanwhile I need to figure out why the bitrate set seems to produce odd results. Without specifying anything the encoding goes up to double the bitrate of the original file, while setting it the result is 40% less. I know that with single pass enconding the bitrate cannot be precise, but this is a little bit too much

        1 Reply Last reply Reply Quote 0
        • hiulitH
          hiulit @Menion
          last edited by

          @Menion Hey, thanks!

          A couple of questions:

          • Does your script work with a Raspberry Pi? Or does it only work on a "host" machine?
          • Does your script only work with VAAPI compatible GPUs? And if so, how could we detect it with the script?

          About merging your script with mine, I would be more inclined in creating a new branch and having two separate scripts, the "default" one and the "host version" one.

          Also, right now i don't have that much time to take a deep look at your script to check it but I'll try in some time soon(ish).

          PS. I'm with @Clyde about using home="$(get_config "home")" instead of hardcoding it into the script ;)

          My little contributions to the RetroPie project:

          • Shell-Script-Boilerplate
          • Fun-Facts-Splashscreens
          • Limit-Last-Played-Games
          1 Reply Last reply Reply Quote 0
          • M
            Menion
            last edited by

            The script should work with any vaapi host, but there is no detection of it, it is just hard coded

            1 Reply Last reply Reply Quote 0
            • F
              furnace @hiulit
              last edited by

              @hiulit
              I've started to use your script and works like a charm. I've even modified it to support video scrapes attained by using Skyscraper on the retropie. I was just wondering though the following.

              1- When the conversion is done, the converted videos are put into the converted directory, correct? can these then be copied back to the original directory to override the bad videos to reduce space usage?

              2- Also if I use the --convert-system flag and let say I already converted a set of videos but then scrape new ones. Will re-running the conversion tool reconvert all the videos or just those that had not been done? If it's all the videos is there a why to just convert specific videos.

              hiulitH 1 Reply Last reply Reply Quote 1
              • hiulitH
                hiulit @furnace
                last edited by

                @furnace Hey thanks! I'm glad you find it useful :D

                It would be great if you can show me what modifications you've done, so maybe I can merge it with my version. Do you have a GitHub account to create a Pull request to my repository with you changes?

                Now, I'm talking without looking at the code:

                1. The script creates this converted folder so you can check if the videos are converted correctly or not. If not, they will a -failed suffix. The ones that are converted successfully are to be copied manually to the proper folder. I didn't code it in the script just in case anything goes wrong with the conversion.

                2. I think it won't reconvert all the videos. Well, it depends, if you pass a from_color argument, the script will only search for the videos that have that particular "color encoding system". If you don't pass any from_color then yes, it will reconvert all the videos. I think.

                In that latter case, I think I will try and add another option to the script to detect the "color encoding system" of the videos you want to encode.

                My little contributions to the RetroPie project:

                • Shell-Script-Boilerplate
                • Fun-Facts-Splashscreens
                • Limit-Last-Played-Games
                F 1 Reply Last reply Reply Quote 0
                • F
                  furnace @hiulit
                  last edited by

                  @hiulit

                  Thanks for the feedback.

                  Sorry I don't have a github account. To modify the scripts though it was fairly simple. Steven Selph's Scraper will put the videos in a folder call video within the ROM folder. Skyscraper can be set to do the same, except the path will be $home/Retropie/roms/media/videos. So all I did was change the VIDEOS_DIR to the proper path.

                  Also your script looks for video file names that end in "-video.mp4", I replaced that to *.mp4 because the video file names are different between the two.

                  I had not set the from_color parameter before, so I'll test that out. Though I had tried to take a video that was not functional with the OMX enabled and pass it to AVprobe as per you script to see the encoding and it returned yuv420p. But once I convert them they are functional. I'm thinking the conversion might change something else which enables the functionality with OMX enabled. I'll keep investigating this and let you know.

                  hiulitH 3 Replies Last reply Reply Quote 1
                  • hiulitH
                    hiulit @furnace
                    last edited by

                    @furnace I can try to do something to "detect" the folders. And yeah, I think I can change the -video.mp4 for just .mp4. Thanks!

                    My little contributions to the RetroPie project:

                    • Shell-Script-Boilerplate
                    • Fun-Facts-Splashscreens
                    • Limit-Last-Played-Games
                    F 1 Reply Last reply Reply Quote 0
                    • F
                      furnace @hiulit
                      last edited by

                      @hiulit
                      Or just as you force the customer to set the -to-color, you could just make the user to set a variable like
                      -source_scraper in the config to shelp or skyscraper and based on this set the video path. Cause I doubt someone would use various scrapers for different systems.

                      hiulitH 1 Reply Last reply Reply Quote 1
                      • hiulitH
                        hiulit @furnace
                        last edited by

                        @furnace Yeah, something like that could work. Thanks!

                        My little contributions to the RetroPie project:

                        • Shell-Script-Boilerplate
                        • Fun-Facts-Splashscreens
                        • Limit-Last-Played-Games
                        1 Reply Last reply Reply Quote 0
                        • hiulitH
                          hiulit @furnace
                          last edited by

                          @furnace Does this answer your question?

                          # From color (optional)
                          # Target only videos with this particular C.E.S.
                          # If left blank, it will target all videos, regardless of the C.E.S.
                          # (e.g. "yuv444p")
                          

                          I haven't tried it yet, but looking at the code I found this.

                          My little contributions to the RetroPie project:

                          • Shell-Script-Boilerplate
                          • Fun-Facts-Splashscreens
                          • Limit-Last-Played-Games
                          1 Reply Last reply Reply Quote 0
                          • hiulitH
                            hiulit @furnace
                            last edited by hiulit

                            @furnace

                            This folder you mentioned $home/Retropie/roms/media/videos when using SkyScraper, does it contain folders for all the systems inside?

                            $home/Retropie/roms/media/videos/megadrive
                            $home/Retropie/roms/media/videos/nes
                            

                            etc?

                            Forget that! I've found this table explaining where all the metadata and media are stored using different scrapers :)

                            https://retropie.org.uk/docs/Scraper/#where-are-my-scraped-media-and-metadata-saved

                            Is this information correct? (I'm guessing it is)

                            My little contributions to the RetroPie project:

                            • Shell-Script-Boilerplate
                            • Fun-Facts-Splashscreens
                            • Limit-Last-Played-Games
                            mituM 1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator @hiulit
                              last edited by

                              @hiulit said in [SCRIPT] RetroPie Convert Videos:

                              Is this information correct? (I'm guessing it is)

                              If you're using the scrapers through the RetroPie-Setup script, then it's correct.
                              Note that fi you're using the CLI parameters for folders or otherwise customize your configuration file, then the folders can be anywhere.

                              hiulitH 2 Replies Last reply Reply Quote 0
                              • hiulitH
                                hiulit @mitu
                                last edited by

                                @mitu Ok, thanks! I'll state that ROM folder for gamelists & media must be enabled. As well as I state the same thing when using Steven Selph's Scraper (use ROM folder for gamelists & images)

                                My little contributions to the RetroPie project:

                                • Shell-Script-Boilerplate
                                • Fun-Facts-Splashscreens
                                • Limit-Last-Played-Games
                                1 Reply Last reply Reply Quote 0
                                • hiulitH
                                  hiulit @mitu
                                  last edited by

                                  @mitu Just out of curiosity, does the built-in EmulationStation scraper have the ability to download videos? It's been ages since I used it and maybe now it does. Thanks.

                                  My little contributions to the RetroPie project:

                                  • Shell-Script-Boilerplate
                                  • Fun-Facts-Splashscreens
                                  • Limit-Last-Played-Games
                                  mituM 1 Reply Last reply Reply Quote 0
                                  • mituM
                                    mitu Global Moderator @hiulit
                                    last edited by

                                    @hiulit No, it doesn't.

                                    hiulitH 1 Reply Last reply Reply Quote 1
                                    • hiulitH
                                      hiulit @mitu
                                      last edited by

                                      @mitu Ok, thanks! Less things to take care then :P

                                      My little contributions to the RetroPie project:

                                      • Shell-Script-Boilerplate
                                      • Fun-Facts-Splashscreens
                                      • Limit-Last-Played-Games
                                      1 Reply Last reply Reply Quote 0
                                      • hiulitH
                                        hiulit
                                        last edited by

                                        Making some progress on supporting both sselph and skyscraper :)

                                        ERROR: There are no systems with videos!
                                        
                                        You are using 'skyscraper' scraper.
                                        Remember to use the 'ROM folder for gamelists & media' option.
                                        
                                        Or maybe try using 'sselph'.
                                        

                                        P.S. Which is better?

                                        • There are no systems with videos!
                                        • There aren't any systems with videos!

                                        English is not my mother language :P

                                        My little contributions to the RetroPie project:

                                        • Shell-Script-Boilerplate
                                        • Fun-Facts-Splashscreens
                                        • Limit-Last-Played-Games
                                        mituM 1 Reply Last reply Reply Quote 0
                                        • mituM
                                          mitu Global Moderator @hiulit
                                          last edited by

                                          @hiulit Not an native English speaker also, but maybe start with videos:

                                          • No videos found for system's games/roms
                                          • No videos found in any system.

                                          Here's an additional challenge - why look up the folder when you can read the video path from the gamelists ? This way you don't have to assume the usage of a particular scraper or a certain path.

                                          hiulitH 1 Reply Last reply Reply Quote 1
                                          • hiulitH
                                            hiulit @mitu
                                            last edited by hiulit

                                            @mitu Thanks! I'll use your examples ;)

                                            As for reading the path directly from the gamelist.xml, wouldn't I have the same problem? I mean, I have to know where the gamelist.xml is stored, and it can vary depending on what scraper is used and what options are set on where to store the gamelist.xml on that particular scraper, right?

                                            ES will check three places for a gamelist.xml in the following order, using the first one it finds:

                                            • [SYSTEM_PATH]/gamelist.xml
                                            • ~/.emulationstation/gamelists/[SYSTEM_NAME]/gamelist.xml
                                            • /etc/emulationstation/gamelists/[SYSTEM_NAME]/gamelist.xml

                                            If you use another scraper (Steven Sselph's scraper or Lars Muldjord's `Skyscraper) you can choose whether your scraped data goes in

                                            • [SYSTEM_PATH]/gamelist.xml (the rom folder) or
                                            • ~/.emulationstation/gamelists/[SYSTEM_NAME]/gamelist.xml

                                            Taken from https://retropie.org.uk/docs/EmulationStation/#scraper.

                                            If I have to know where the gamelist.xml is stored then I might just tell the user to use the option to store the media "where I want it" to be :P
                                            Or "force" the user to have the gamelist.xml "where I want it" to be).

                                            My little contributions to the RetroPie project:

                                            • Shell-Script-Boilerplate
                                            • Fun-Facts-Splashscreens
                                            • Limit-Last-Played-Games
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.