iChux
iChux

Reputation: 2386

How do I use ffmpeg to extract the total time of a video slice without actually producing the video slice?

I have a video named 'ev.mp4'. Slice the video into segments:

# COMMAND 1
ffmpeg -i "ev.mp4" -c copy -map 0 -segment_time 15 -g 9 \
    -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" \
    -reset_timestamps 1 -f segment ev-%04d.mp4

ev-0000.mp4
ev-0001.mp4
ev-0002.mp4

Get each segment time

# COMMAND 2
for f in ev-*.mp4;
do
    echo $f == $(ffprobe -v error -show_entries \
    format=duration -of default=noprint_wrappers=1:nokey=1 $f);
done;

ev-0000.mp4 == 17.251000
ev-0001.mp4 == 17.918000
ev-0002.mp4 == 10.444000

I am only able to extract the duration of each sliced segment after the videos have existed in a sliced format on the hard drive e.g. ev-0000.mp4

My question: is it possible to get the duration of each slice from COMMAND 1 such that instead of producing the sliced files, I will get the duration of each slice?

Upvotes: 0

Views: 184

Answers (1)

kesh
kesh

Reputation: 5533

No, it is not possible. The segment muxer is intended to write its outputs to files. No file, no template, no way to configure the muxer. Read this

Upvotes: 1

Related Questions