• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Possible to re-encode videos and keep same name?

Scheduled Pinned Locked Moved Help and Support
reencode
12 Posts 3 Posters 441 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.
  • G
    g0nz0uk
    last edited by 22 May 2020, 23:07

    Hello,

    My arcade mp4 video previews were ok on the Pi3 but not on the Pi4, I’ve used Handbrake to re-encode a few and they work after, but Handbrake renames the files slightly different so my gamelist.xml gets mismatched so the videos don’t play as they are looking for a slightly different name for each video. I can’t go and edit 100s of lines of code or rename all the videos.

    I tried to change some of the output save settings in Handbrake but none would keep the original source name as it’s save new name.

    My current gamelist.xml has all the right names and cover art working, I just need to sort the video names.

    Any ideas?

    Thanks

    W 1 Reply Last reply 22 May 2020, 23:29 Reply Quote 0
    • W
      WeirdH @g0nz0uk
      last edited by 22 May 2020, 23:29

      @g0nz0uk If your videos are saved uniformly or if you're handy with regular expressions, you could try Bulk Rename Utility after Handbraking.

      G 1 Reply Last reply 23 May 2020, 08:57 Reply Quote 0
      • G
        g0nz0uk @WeirdH
        last edited by 23 May 2020, 08:57

        @WeirdH

        Thanks that tool looks good.

        I have over 1000 files like this below that have the word video at the end:

        1941Video.mp4

        I need to rename all so there is a hyphen between the name and the word video like this:

        1941-Video.mp4

        I just can't figure it out yet.

        1 Reply Last reply Reply Quote 0
        • W
          WeirdH
          last edited by WeirdH 23 May 2020, 09:16

          It's pretty easy to only change a hyphen. Navigate to your files. Put the change you want in box 3 'Replace' (step 1). You can ignore everything else. Select the files to which you want to apply the change in the list above (probably all of them in your case) and then hit Rename (step 2).

          Please note if you have any files that already have the hyphen and you apply this change to them as well, they will end up with doubled up hyphens, like --video, so exercise caution.

          BRU.png

          1 Reply Last reply Reply Quote 1
          • G
            g0nz0uk
            last edited by 23 May 2020, 13:52

            You are brilliant! Thanks.

            I did a test and my videos are now showing in Retropie after re-encoding them and then renaming.

            What snipping/screen grab tool is that, I like the green arrow.

            W 1 Reply Last reply 23 May 2020, 14:05 Reply Quote 0
            • W
              WeirdH @g0nz0uk
              last edited by 23 May 2020, 14:05

              @g0nz0uk Glad to help.

              I just prinstcreened the program, cropped and added the arrow in Photoshop. Googled it.

              G 1 Reply Last reply 23 May 2020, 15:29 Reply Quote 0
              • G
                g0nz0uk @WeirdH
                last edited by 23 May 2020, 15:29

                @WeirdH

                Nice, a trickier question I have is can I make the first letter lowercase instead of uppercase?

                1 Reply Last reply Reply Quote 0
                • G
                  g0nz0uk
                  last edited by g0nz0uk 23 May 2020, 15:36

                  Think I've done, what a great tool.

                  1 Reply Last reply Reply Quote 1
                  • W
                    WeirdH
                    last edited by 23 May 2020, 18:11

                    Wouldn't know from memory. Probably box 4 'case', right?

                    1 Reply Last reply Reply Quote 0
                    • C
                      Clyde
                      last edited by Clyde 24 May 2020, 09:46

                      Ultimately, Handbrake is "just" a frontend for a couple of encoding libraries like libavcodec from the FFmpeg project. If you just want to convert all videos in a given directory with the same options, you could also use ffmpeg directly to do that.

                      Here's an example for the Retropie's command shell bash that you could use directly on your Pi, another Linux machine or any OS with a compatible command shell.

                      mkdir -p output; for video in *.mp4; do ffmpeg -i "$video" output/"${video%.*}".mkv; done
                      

                      This will create the subdirectory output if it is not already present, convert any .mp4 files in the current directy into .mkv files, and save them to the output directory, choosing any video and audio codecs that are compatible with mkv containers automatically. They will keep their names except for the mp4 extension. In that example, video is a variable that contains the video filename of the current for…do…done loop, $video recalls that variable, and ${video%.*} recalls it without the file extension (i.e. .mp4). The quotation marks are important if the videos' filenames contain any special characters like spaces, brackets, slashes and so on.

                      You can use this as a baseline for any other ffmpeg invocation, there are many guides on the net about that, like these to more recent ones:

                      • https://catswhocode.com/ffmpeg-commands/
                      • https://www.dedoimedo.com/computers/ffmpeg-guide.html

                      Just as an alternative answer to the topic's title question, for you or anyone else who stumbles upon this thread. 😊

                      G 1 Reply Last reply 24 May 2020, 10:12 Reply Quote 1
                      • G
                        g0nz0uk @Clyde
                        last edited by 24 May 2020, 10:12

                        @Clyde wow this is great thanks. I wished I'd done this first it would of save a lot of time.

                        1 Reply Last reply Reply Quote 0
                        • C
                          Clyde
                          last edited by 25 May 2020, 11:51

                          My pleasure. Such one-liners are a good way to automate things with relatively little syntax research needed. 😎 (They're actually multiple commands separated by semicolons.)

                          That said, they also can be a source for agonizing frustration if they don't do what you want – until they do, eventually. 😉

                          1 Reply Last reply Reply Quote 0
                          3 out of 12
                          • First post
                            3/12
                            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.

                            This community forum collects and processes your personal information.
                            consent.not_received