Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-20 Thread Carl Zwanzig
On 1/20/2022 6:08 AM, Bo Berglund wrote: So it creates 3 instances of the duration output... It does, because they come from three different places (and the values may be different). Have to add | tail -n 1 to the end to get one item only. Nothing wrong with that, or with telling

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-20 Thread Bo Berglund
On Wed, 19 Jan 2022 20:30:32 +0200, Peter van den Houten wrote: >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

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Reindl Harald
Am 19.01.22 um 19:07 schrieb Carl Zwanzig: On 1/19/2022 3:23 AM, Bo Berglund wrote: I have tried in various ways to limit the output of ffmpeg/ffprobe to the line holding the duration but it seems impossible... Beware! Depending on the source of a recording, I've found that various

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Reino Wijnsma
On 2022-01-19T12:23:07+0100, Bo Berglund wrote: > ffprobe -hide_banner -i input.mp4 | grep Duration ffprobe -hide_banner input.mp4 2>&1 | grep Duration - 2>&1, because ffprobe (as well as ffmpeg) send the information to stderr. - Unlike ffmpeg, -i isn't needed for ffprobe and ffplay. On

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Peter van den Houten
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

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Carl Zwanzig
On 1/19/2022 3:23 AM, Bo Berglund wrote: I have tried in various ways to limit the output of ffmpeg/ffprobe to the line holding the duration but it seems impossible... Beware! Depending on the source of a recording, I've found that various methods will report different values* for the

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Bo Berglund
On Wed, 19 Jan 2022 18:26:21 +0530, Gyan Doshi wrote: > > >On 2022-01-19 05:29 pm, Bo Berglund wrote: >> On Wed, 19 Jan 2022 17:10:26 +0530, Gyan Doshi wrote: >> What do I need to just get that output I want? >>> The closest you can get is >>> >>>      ffprobe -v 0 -of compact=p=0:nk=1

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Bo Berglund
On Wed, 19 Jan 2022 12:59:45 +0100, Bo Berglund wrote: >Thanks, this returns the following output: >0:43:26.384000 > >Can the duration be limited to only seconds resolution (no decimals)? > Turns out I found a simple way: CMD="ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Gyan Doshi
On 2022-01-19 05:29 pm, Bo Berglund wrote: On Wed, 19 Jan 2022 17:10:26 +0530, Gyan Doshi wrote: What do I need to just get that output I want? The closest you can get is      ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries format=duration INPUT Thanks, this returns the

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Reindl Harald
Am 19.01.22 um 12:59 schrieb Bo Berglund: On Wed, 19 Jan 2022 17:10:26 +0530, Gyan Doshi wrote: What do I need to just get that output I want? The closest you can get is      ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries format=duration INPUT Thanks, this returns the

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Bo Berglund
On Wed, 19 Jan 2022 17:10:26 +0530, Gyan Doshi wrote: >> What do I need to just get that output I want? > >The closest you can get is > >      ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries >format=duration INPUT Thanks, this returns the following output: 0:43:26.384000 Can the

Re: [FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Gyan Doshi
On 2022-01-19 04:53 pm, Bo Berglund wrote: This is on Linux: I have tried in various ways to limit the output of ffmpeg/ffprobe to the line holding the duration but it seems impossible... I have a need to display the video duration as h:m:s on a listing of videos in a directory. So I want to

[FFmpeg-user] How to get video duration in a script using ffmpeg?

2022-01-19 Thread Bo Berglund
This is on Linux: I have tried in various ways to limit the output of ffmpeg/ffprobe to the line holding the duration but it seems impossible... I have a need to display the video duration as h:m:s on a listing of videos in a directory. So I want to create a small script to be called with the