Nvidia Jetson/Linux

폴더 안 비디오 파일들 일괄적으로 마지막 프레임만 추출하기(dump a last frame of the videos from the folder) bash

으르렁그르릉 2020. 7. 7. 00:07

#!/bin/bash

for fn in *.mp4
do

  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
done