what is the packet size unit of ffprobe(similar to ffmpeg)?
Asked Answered
O

2

9

I am developing thumbnail extractor with ff- series(means ffmpeg, ffplay, ffprobe).

I need to know the location of frames, so I use a command like below which I found another posting in stackoverflow.

ffprobe -show_frames -select_streams v -print_format json=c=1 0001.wmv

Actually it works nice and makes a file with lots of information of packet.

The output file like below.

   "frames": [
        { "media_type": "video", "key_frame": 1, "pkt_pts": 900000, "pkt_pts_time": "10.000000", "pkt_dts": 900000, "pkt_dts_time": "10.000000", "pkt_duration": 3003, "pkt_duration_time": "0.033367", "pkt_pos": "453", "pkt_size": "9744", "width": 720, "height": 480, "pix_fmt": "yuv420p", "sample_aspect_ratio": "8:9", "pict_type": "I", "coded_picture_number": 0, "display_picture_number": 0, "interlaced_frame": 0, "top_field_first": 0, "repeat_pict": 0 },...

There is a column named "pkt_size", which I assume that size of packet.

It displays some numbers in, but no information of units.

I wonder that unit is 'byte' or 'bit'.

If somebody has some information of this, Tell me.

Thanks.

Oram answered 7/8, 2013 at 3:47 Comment(0)
R
9

The unit is byte.

The best clue for this is from tools/plotframes, a tool provided by ffmpeg to generate a plot of frame sizes. Check this code snippets, which would output frame size in Kbits (pkt_size * 8 /1000).

foreach my $frame (@{$frames}) {
    my $type = $frame->{pict_type};
    $frame->{count} = $frame_count++;
    if (not $stats{$type}) {
        $stats{$type}->{tmpfile} = File::Temp->new(SUFFIX => '.dat');
        my $fn = $stats{$type}->{tmpfile}->filename;
        open($stats{$type}->{fh}, ">", $fn) or die "Can't open $fn";
    }

    print { $stats{$type}->{fh} }
        "$frame->{count} ", $frame->{pkt_size} * 8 / 1000, "\n";
}
Rosemarierosemary answered 26/8, 2014 at 8:45 Comment(3)
Thanks for answer. I assume you have right answer. But this code seems unfamiliar with me so would you tell me what language is this?Oram
ffmpeg/tools/plotframes is a perl script.Rosemarierosemary
Would you consider to put my reply as the answer to your question?Rosemarierosemary
F
5

You can also see the units by passing to ffprobe the '-unit' option

Like

ffprobe -show_frames -select_streams v -print_format -unit json=c=1 0001.wmv
Forgiven answered 4/9, 2017 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.