[FFmpeg-user] Get bitrate from stream

Jesper Nilsson jesperpoppenilsson at gmail.com
Mon Sep 24 14:26:16 EEST 2018


Hey Moritz, thanks for the reply
Im currently running this command:
fprobe <input.AAC> -select_streams a:0 -show_entries stream=bit_rate -of
default=nk=1:nw=1
Output:
ffprobe version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2007-2018 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libflite --enable-libfontconfig
--enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libpulse
--enable-librubberband --enable-librsvg --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx
--enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394
--enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[aac @ 0x55e510fe4420] Estimating duration from bitrate, this may be
inaccurate
Input #0, aac, from
'input.aac':

  Duration: 01:41:49.14, bitrate: 330 kb/s
    Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 330 kb/s
330000

This results in a bitrate of 330000, but i know that the actual and correct
value is 320000. When i use the command you sent, the last pkt_pts_time is
the total duration and that value is correct. When using my commad i get
101 minutes, and the duration is 105 minutes.

When i tired your command the entire output is logged, and broke my proxy.
Can i make the -select_frames command silent, only printing the laste
output? im only intrested in the last frame.

Kind Regards, Jesper

Den fre 21 sep. 2018 kl 16:00 skrev Moritz Barsnick <barsnick at gmx.net>:

> On Fri, Sep 21, 2018 at 14:47:27 +0200, Jesper Nilsson wrote:
> > Commands Used:
> >
> > ffprobe -select_streams v:0 -show_entries
> frame=pkt_size,pkt_duration_time
> > <input.aac>
>
> The output of that command changes significantly, if you actually
> select the *audio* stream: "-select_streams a:0". (Your AAC file
> probably has no 0:v.)
>
> Since it's obviously a VBR audio track, you need to let ffmpeg, or in
> this case ffprobe, probe all the way to the actual end of the stream,
> to get the real value. As you probably realized.
>
> I used this command:
>
> $ ffprobe -select_streams a:0 -show_entries
> frame=pkt_pts_time,pkt_duration_time input.aac
>
> to see all frames' actual timestamps.
>
> I guess the "proper" length of the audio track - assuming no
> discontinuous PTS - is the last frame's
> pkt_pts_time + pkt_duration_time
>
> Hope this helps,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list