[FFmpeg-user] Taking screenshots before and after re-encoding

Martin Cracauer cracauer at cons.org
Sat Feb 13 15:24:22 CET 2016


[mostly a sports/puzzle question at this point]

I am trying to take screenshots using complex_filter fps and png
output, and I am trying to do this at 2 stages in the pipeline: before
and after re-encoding the video.  I have multi-stage screenshotting
running just fine when the different stages are all *inside* the complex
filter.  However, I don't seem to be able to "grab" the output of the
reencoding.  So to speak there is no name given to it to then use in a
second filter_complex.

The way I understand it is that the output of the reencoding goes
directly to the output file and there is no way to grab it from the
second complex filter.  Wondering whether somebody can confirm that?

Attached is a variant that does double screenshotting, however both
sets of screenshots are the original quality, not the reendoing
output.

In this particular version that is to be expected since I use [0:v]
but I have tried many, many variants of this to get to the encoding
output and nothing helped.  Using an empty input on the second filter
didn't work (can't figure out what the inut is and I have no name from
the encoding output).

#! /bin/sh

out="${1%.*}"
pictureformat=png
BITRATE=6

ffmpeg -y -t 10 \
-vn -an -sn \
-i "$1" \
-filter_complex \
"[0:v]          split   [vid][preshots]
;[preshots]     fps=1/1 [preshots]
" \
-map '[preshots]' "$out-snot%04d-tee0.$pictureformat" \
-map '[vid]' -map '0:a' -map '0:s' \
-c:v ${CODEC-libx264} \
-b:v ${BITRATE-6000}k \
-c:a ${ACODEC-copy} \
-c:s copy \
-filter_complex \
"[0:v]       split   [vid][postshots]
;[postshots] fps=1/1 [postshots]
" \
-map '[vid]' -map '0:a' -map '0:s' ${out}_smaller.mkv \
-map '[postshots]' "$out-snot%04d-tee1.$pictureformat" \
|| exit


-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer at cons.org>   http://www.cons.org/cracauer/


More information about the ffmpeg-user mailing list