Dealing with certain Youtube files (ie, from Rhino Entertainment) requires trimming off the 15 or so 'also recommended' seconds at the end of every video. The number of seconds and starting position varies, so it'd be tricky to script (perhaps with -af silencedetect), so I'm doing it manually. And on Windows, for some reason. (Obviously, this is all trivial on 'nix, without requiring any kludges.)
I have the unixtools for Windows installed; the version of tr and sed in it reads pipes or redirects at the end as additional input; Windows inserts "" around filenames by default with tab completion. tr -d "\"" (and the sed equivalent of s/\"//g) both barf removing it... (and, there doesn't seem to be a way of directly setting the output of a command to a variable with batch files...) This is ugly, inelegant, and mostly an exercise in unnecessary complexity, because after an hour, it was personal. With a little more effort, this could be even more spectacularly nasty.
trkludge.bat:
@echo %1 | tr -d "\""
ytstrip.bat:
@echo off
call trkludge %1 >> temp.tmp
set /p output=<temp.tmp
del /q temp.tmp
ffmpeg -hide_banner -t %2 -i %1 -c copy -map_metadata 0 output\%output%
mv %1 pending_delete\
Usage example:
\tmp\in\mvid\inc>ytstrip "RhinoEntertainment-All_Saints-Black_Coffee_Official_Music_Video[v0Xej6Sz5nU].mp4" 4:14
To be more absurd, an improvement would be to use 'for' to loop through all the desired files, prompting just for the time on each one... or, prompting for both pre and post cut (to handle kontor.tv and Spinnin' Record files as well.)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment