Opened 12 years ago

Closed 11 years ago

#1437 closed enhancement (fixed)

probe less than the whole file with -show_frames

Reported by: Mark Himsley Owned by: stefano
Priority: wish Component: ffprobe
Version: git-master Keywords: ffprobe seek
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description (last modified by Clément Bœsch)

I'd like to probe a file to get interlaced_frame="1" top_field_first="1" - which I believe is only available in
-show_frames.

My file is 30 minutes log - I only want the data from the first frame.

I can't see anything in -h to answer this question. The ffmpeg -vframes, -frames:v and -t are not listed in ffprobe's help, and do not work.

I usually use FFprobe with a -probesize, and that is also ignored with -show_frames.

Stefano suggested "And of course you can get it with a crude trick, you trim the file
*physically* in order to reduce the amount of data to be decoded" but that's a workaround I'd like to avoid.

example current file based command line:

% ffprobe -show_format -show_streams -show_frames -probesize 40000 -print_format xml "tortoise.mxf"
ffprobe version N-41487-gee1748a Copyright (c) 2007-2012 the FFmpeg developers
  built on Jun 10 2012 17:04:40 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
  configuration: --prefix=/Users/mdsh/ffmpeg --arch=x86_64 --enable-ffplay --enable-ffprobe --enable-shared --disable-indev=jack --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libx264
  libavutil      51. 56.100 / 51. 56.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 78.101 /  2. 78.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mxf @ 0x7fddb081ae00] Stream #0: not enough frames to estimate rate; consider increasing probesize
[mxf @ 0x7fddb081ae00] Stream #1: not enough frames to estimate rate; consider increasing probesize
Input #0, mxf, from 'tortoise.mxf':
  Metadata:
    timecode        : 10:53:51:04
  Duration: 00:28:21.92, start: 0.000000, bitrate: 42598 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 608:405 DAR 16:9], 30000 kb/s, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 4 channels, s16, 3072 kb/s
<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
    <frames>
        <frame media_type="video" key_frame="1" pkt_pts="0" pkt_pts_time="0.000000" pkt_dts="0" pkt_dts_time="0.000000" pkt_duration="1" pkt_duration_time="0.040000" pkt_pos="7168" width="720" height="608" pix_fmt="yuv422p" sample_aspect_ratio="608:405" pict_type="I" coded_picture_number="0" display_picture_number="0" interlaced_frame="1" top_field_first="1" repeat_pict="0" reference="3"/>
        <frame media_type="audio" key_frame="1" pkt_pts="0" pkt_pts_time="0.000000" pkt_dts="0" pkt_dts_time="0.000000" pkt_duration="1" pkt_duration_time="0.040000" pkt_pos="157696" sample_fmt="s16" nb_samples="1920"/>
[...]

goes on for a long time - you *really* don't want the uncut output

Change History (3)

comment:1 by Carl Eugen Hoyos, 12 years ago

Priority: normalwish
Status: newopen

comment:2 by Clément Bœsch, 12 years ago

Description: modified (diff)

comment:3 by Stefano Sabatini, 11 years ago

Analyzed by developer: set
Keywords: ffprobe seek added
Reproduced by developer: set
Resolution: fixed
Status: openclosed

Should be fixed in:

commit f0606a28deca304462349f623118a79069938339
Author: Stefano Sabatini <stefasab@gmail.com>
Date:   Mon Oct 22 16:01:29 2012 +0200

    ffprobe: add -read_intervals option
    
    This is also useful to test seeking on an input file.
    
    This also addresses trac ticket #1437.

To read only the first packet from the start (and corresponding frames):

ffprobe -show_frames -print_format xml -read_intervals "%+#1" INPUT
Note: See TracTickets for help on using tickets.