[FFmpeg-user] How to get video duration in a script using ffmpeg?
Peter van den Houten
petervdh at gmail.com
Wed Jan 19 20:30:32 EET 2022
On 19/01/2022 20:12, Shupert, Jim via ffmpeg-user wrote:
> I have used mediainfo
>
> mediainfo --Inform="Video;%Duration/String3%" $SrcDir/${f%.*}.* > $HOME/t.txt
> trt=$(<$HOME/t.txt)
>
This is more accurate for bitrate as it doesn't read headers but does sample reads of the file (some formats do not express bitrate in the headers). It therefore takes a bit longer:
mediainfo --parsespeed=1 filename
More information about the ffmpeg-user
mailing list