質問

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.

役に立ちましたか?

解決

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";
}

他のヒント

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top