I just found out about FFMPEG and I need it to cut loads of MP4 files to the last 20 seconds of each. Each MP4 file has one video track and two audio tracks, and also have Variable Frame Rate.
I've been using this line of code:
for %F in (*.mp4) do ffmpeg -sseof -20 -i "%F" -map 0:v -map 0:a -c:v copy -c:a copy "%~nF_trimmed.mp4"
The trimming goes well but there's a problem with the audio. This error appears without canceling the trimming process, though I believe it has nothing to with my problem:
[mp4 @ 0000025740443740] track 1: codec frame size is not set [mp4 @ 0000025740443740] track 2: codec frame size is not set
And when I drop the trimmed files to a video editing software, this can be seen:
The second audio track is longer than the video track.
The -shortest command didn't do the trick. Maybe I'm just using it wrong?