[FFmpeg-devel] [PATCH] ffprobe: add support to audio frame information printing
Stefano Sabatini
stefasab at gmail.com
Thu Jan 12 10:49:19 CET 2012
On date Thursday 2012-01-12 03:43:09 +0100, Clément Bœsch encoded:
> On Wed, Jan 11, 2012 at 12:43:13PM +0100, Stefano Sabatini wrote:
> [...]
> > > > static void show_packets(WriterContext *w, AVFormatContext *fmt_ctx)
> > > > {
> > > > - AVPacket pkt;
> > > > + AVPacket pkt, pkt1;
> > > > AVFrame frame;
> > > > - int i = 0;
> > > > + int i = 0, ret, got_frame;
> > > >
> > > > av_init_packet(&pkt);
> > > >
> > > > while (!av_read_frame(fmt_ctx, &pkt)) {
> > > > if (do_show_packets)
> > > > show_packet(w, fmt_ctx, &pkt, i++);
> > > > - if (do_show_frames &&
> > > > - get_video_frame(fmt_ctx, &frame, &pkt)) {
> > > > - show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]);
> > > > + if (do_show_frames) {
> > > > + pkt1 = pkt;
> > > > + while (1) {
> > > > + ret = get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt1);
> > > > + if (ret < 0 || !got_frame)
> > > > + break;
> > >
> >
> > > I'm not sure, but I think the API needs you to deal with the special case
> > > of ret < 0. See 220481e1d6582277ae4c02b05f87251a8670e6cc for instance. I
> > > can look for a sample to confirm this if you need one.
> >
> > Should not be necessary since the packet is just dropped in case ret <
> > 0, and no more processing is done with it, but testing with a sample
> > can't hurt.
> >
>
> Confirmed with a sample here, it's OK.
Updated, crash with MP3 files should be fixed now.
> Note: a -only:[av] option would be nice to filter only audio or video
> frames.
My idea was using avconv/ffmpeg selectors in the various options, I
wonder if this makes sense (for example: -show_frames:a
-show_packets:v -show_streams:v0).
--
FFmpeg = Fascinating Fancy Muttering Purposeless Enhanced Gymnast
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffprobe-add-support-to-audio-frame-information-print.patch
Type: text/x-diff
Size: 6311 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120112/b3bc75c5/attachment.bin>
More information about the ffmpeg-devel
mailing list