10

I want to determine stream size(not the video size) and using the following ffprobe command to make this work

ffprobe -v error -count_packets -select_streams a:0 -show_entries stream=size my_input_file_name

But this is not working, and producing no output, Can anybody point the issue with this command

2 Answers2

14

Perform a null mux.

ffmpeg -i input -map 0:a:0 -c copy -f null -

The final readout will have that info:

video:0kB audio:2684kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Gyan
  • 36,303
  • Can this not be done only using ffprobe? Like analysing the packets or frames show_frames,show_packets output? – user2528012 Sep 09 '17 at 12:38
  • You want a sum, not individual packet info, so no. – Gyan Sep 09 '17 at 14:20
  • 1
    If I sum up the size attribute of -show_packets command then do you think this will work? ffprobe -v error -show_packets -select_streams a -show_entries packet=size -of default=nokey=1:noprint_wrappers=1 video.mp4 – user2528012 Sep 09 '17 at 14:53
  • Ok, that should work. Remove the -show_packets; that's unnecessary clutter. – Gyan Sep 09 '17 at 15:04
2

For a simple and immediate way of obtaining detailed info about a media file, try mediainfo utility. It will specify the video/audio stream sizes too.

mediainfo MyFilename.mp4 for basic info

mediainfo --fullscan MyFilename.mp4 for more detailed info

Output example:

~> mediainfo MyFilename.mp4
General
Complete name                            : ~/MyFilename.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2)
File size                                : 1.03 GiB
Duration                                 : 3 h 9 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 781 kb/s
Encoded date                             : UTC 2021-10-08 21:36:28
Tagged date                              : UTC 2021-10-08 21:36:28

Video ID : 2 Format : AVC Format/Info : Advanced Video Codec Format profile : Baseline@L4 Format settings : 1 Ref Frames Format settings, CABAC : No Format settings, Reference frames : 1 frame Format settings, GOP : M=1, N=48 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 3 h 9 min Duration_LastFrame : -48 ms Bit rate : 712 kb/s Nominal bit rate : 1 000 kb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 8.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.043 Stream size : 963 MiB (91%) Writing library : x264 core 148 r2M 3713d6c Encoding settings : cabac=0 / ref=1 / deblock=0:0:0 / analyse=0:0 / me=dia / subme=0 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=48 / keyint_min=4 / scenecut=0 / intra_refresh=0 / rc=abr / mbtree=0 / bitrate=1000 / ratetol=1.0 / qcomp=0.60 / qpmin=20 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=0 Language : English Encoded date : UTC 2021-10-08 21:36:28 Tagged date : UTC 2021-10-08 21:36:28 Codec configuration box : avcC

Audio ID : 1 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 3 h 9 min Bit rate mode : Variable Bit rate : 68.3 kb/s Maximum bit rate : 89.1 kb/s Channel(s) : 1 channel Channel layout : C Sampling rate : 16.0 kHz Frame rate : 15.625 FPS (1024 SPF) Compression mode : Lossy Stream size : 92.5 MiB (9%) Language : English Encoded date : UTC 2021-10-08 21:36:28 Tagged date : UTC 2021-10-08 21:36:28

See original post and other tools here.

  • 2
    It doesn't show stream size if the file doesn't advertise it in a tag. – André Chalella Sep 08 '22 at 21:07
  • All that's doing is reading tags. If you re-encode the MKV file without clearing out the metadata, you'll receive the wrong information. I've had mediainfo tell me the audio stream was bigger than the entire file bc of that. – Cliff Aug 17 '23 at 01:18