[FFmpeg-user] RETRIEVE FRAME RATE WITH DECIMAL VALUE

Reino Wijnsma rwijnsma at xs4all.nl
Thu Nov 14 17:05:30 EET 2024


Hello Hervé,

On 2024-11-10T20:59:43+0100, Hervé ANSELME <hervea95-at-hotmail.com at ffmpeg.org> wrote:
> Hi,
On this mailinglist you're expected to put your reply _beneath_ the quoted message (bottom-posting). So please refrain from top-posting.
 
> I apologize, I forgot to mention that my OS is windows 11.
There are of course multiple tools available that you can use, but one I can recommend is Xidel <https://videlibri.sourceforge.net/xidel.html>:

ffprobe -hide_banner -v 0 -select_streams v:0 -show_entries stream=avg_frame_rate -of default=nk=1:nw=1 "input.mkv" | ^
xidel -se "replace($raw,'/',' div ') => eval() => round-half-to-even(6)"
23.976024

ffprobe -hide_banner -v 0 -select_streams v:0 -show_entries stream=avg_frame_rate -of default=nk=1:nw=1 "input.mkv" | ^
xidel -s ^
  -e "$raw"^
  -e "replace($raw,'/',' div ')"^
  -e "replace($raw,'/',' div ') => eval()"^
  -e "replace($raw,'/',' div ') => eval() => round-half-to-even(6)"^   # XPath 3.1 method <https://www.w3.org/TR/xpath-31/#id-arrow-operator> of applying multiple functions to a value in turn.
  -e "round-half-to-even(eval(replace($raw,'/',' div ')),6)"           # Classic way of applying multiple functions to a value in turn.
24000/1001
                        # $raw, ffprobe's output, is actually 24000/1001\r\n, i.e. it ends with a carriage return + line feed.
24000 div 1001

23.976023976023976024
23.976024
23.976024

-- 
Reino



More information about the ffmpeg-user mailing list