8/18/2023 0 Comments Handbrake video compressorThe first and best is to use Advanced Renamer's timestamp method, which CAN change file date modified, created, and accessed, not just the file name itself. Since most of my videos have the date/time in the filename, I experimented and got two methods to work. To run do: sudo bash script.sh /sourcedir /converteddirĪfter much searching, I mostly gave up on using old video files with correct date created/modified to overwrite the date created/modified of my new Handbrake-compressed video files. ![]() Both paths must have the same number of files in the same order." #Loops through the arrays and runs touch command on pairs of files to transfer the metadataĮcho "The provided paths do not have the same number of files. #Checks if source and convert folders have the same number of files #Adds filepaths from the converted directory to cnvf array #Adds filepaths from the source directory to srcf array #Source directory and converted direcotry #Sets IFS to \n to allow for filenames with spaces The code might not be the neatest as it was my first proper bash script, but it's been pretty fast and stable for me, so here goes: #!/bin/bash The script lists all the file pairs so you can check for errors in the end if you want. Then it just copies the metadata and you're all set and done. For it to work you must have your original and converted files on separate directories, each with the same number of files (the directories must only have the video files, as other files/directories will interfere) and in the same order. I made a bash script that can batch transfer the metadata, using touch as suggested above. ![]() Read the x264 encoding guide on the FFmpeg wiki for more. See the AAC encoding guide for more info. ![]() 23 is default, and anything below 18 will probably be visually lossless. In order to change the quality of the output, you can: This will convert the input with the x264 encoder and AAC audio to an output file, copying the original metadata. In the simplest case you can do your conversion like this: ffmpeg -i in.mp4 -c:v libx264 -crf 23 -c:a aac -map_metadata 0 out.mp4 $ mediainfo fixed.mp4 | grep "Encoded date" | head -n 1Īctually, you don't really need to use Handbrake if you can use FFmpeg, which Handbrake relies on anyway. Here's the final file after mapping the metadata: $ ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy fixed.mp4 Here's the file after Handbrake conversion: $ mediainfo out.mp4 | grep "Encoded date" | head -n 1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |