1

I am trying to delete the very last frame of a video using ffmpeg / mencoder / transcode / or any other free linux application.

Here is what I have so far, and it's only extracting it, it's not deleting it from the actual video file.

#!/bin/bash

fn="$1"
of=${fn%.*}.jpg

lf=`ffprobe -show_streams "$fn" 2> /dev/null | awk -F= '/^nb_frames/ { print $2-1 }'`
rm -f "$of"
ffmpeg -i "$fn" -vf "select='eq(n,$lf)'" -vframes 1 "$of" 2> /dev/null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.