So, on my Ubuntu 20.04 machine I have a ton of videos on my hard drive, some downloaded with YouTube-DL while others were downloaded with YT-dlp. I have a bad habit of using the -k flag which keeps the video only and audio only files, and I need a script to recursively search through a directory where all my videos are stored and hard-link the video-only and audio-only files back to the video+audio file, while also using FFmpeg to verify that they match before actually linking them.
Sample file names from YT-dlp are:
Title [FYBZ95auLJY].f308.webm - Video only
Title [FYBZ95auLJY].f251.webm - Audio only
Title [FYBZ95auLJY].webm - Both Video and AudioKeep in mind the extension may not be the same for all three videos.
The way the verifying might work is by checking if the video/audio only file (ending with f??? or f?? before the extension) is video or audio only, if it's both it should be skipped since that would indicate it's already linked. If it's video or audio, use FFmpeg to copy only the video/audio portion into an MKV container in ~/Documents/Verify, do the same for the file that's both video and audio, and check if the hashes match. If they do, then remove both files and hard-link the video/audio file to the file that contains both video and audio.
What would be the best way to do this?
4 Reset to default