Cut the last one minute of a movie? Sound simple enough and I've almost got it but my bash skills let me down on the simplest of things!
Step 1 get movie length - many ways here's one
Code:
jonk@XEON4 ~/CK $ ffprobe -i CK.mp4 -show_format -v quiet | sed -n 's/duration=//p'
301.040000
So that's a length of 301 seconds
Step 2 subtract 1 minute
Code:
jonk@XEON4 ~/CK $ echo $(( 301 - 60))
241
So that's a start point of 241 seconds, my -ss parameter for ffmpeg.
Step three combine all this in a script, I tried combining the first two steps
Code:
jonk@XEON4 ~/CK $ echo $(( $(ffprobe -i CK.mp4 -show_format -v quiet | sed -n 's/duration=//p') - 60))
bash: 301.040000 - 60: syntax error: invalid arithmetic operator (error token is ".040000 - 60")
jonk@XEON4 ~/CK $
So my question is how to combine a complex command in an arithmetic bash statement?
Or maybe there is another way to use ffmpeg to cut the last minute of a movie.
BTW I intend to loop through a folder of movies to cut the last minute from all of them which is why I want to parameterise this operation.
TIA