Opened 9 years ago

Closed 15 months ago

#4427 closed defect (fixed)

ffprobe read_intervals not correctly working with avi

Reported by: martinr92 Owned by:
Priority: normal Component: ffprobe
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
I'd like to receive the key frames of a avi video, that are in a range of 2-5 seconds.
For this I'm using ffprobe

ffprobe -print_format json -select_streams v -read_intervals 00:00:10%+2 -show_frames test.avi

It's a 25 fps video, so I should receive 50 frames + maybe some frames before second 10 (seeking to the key-frame). In this case, it starts with frame 195 (7,8 seconds) which is ok.

{
    "frames": [
        {
            "media_type": "video",
            "key_frame": 1,
            "pkt_dts": 195,
            "pkt_dts_time": "7.800000",
            "best_effort_timestamp": 195,
            "best_effort_timestamp_time": "7.800000",
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "656024",
            "pkt_size": "28089",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_dts": 196,
            "pkt_dts_time": "7.840000",
            "best_effort_timestamp": 196,
            "best_effort_timestamp_time": "7.840000",
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "697704",
            "pkt_size": "2325",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "B",
            "coded_picture_number": 3,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_dts": 197,
            "pkt_dts_time": "7.880000",
            "best_effort_timestamp": 197,
            "best_effort_timestamp_time": "7.880000",
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "694028",
            "pkt_size": "2500",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "B",
            "coded_picture_number": 2,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        }, [....]

Not ok for me is the end, because it should stop after frame 300 (second 12). In this case, it's running to frame 791 (31 seconds), End of video.

        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_dts": 790,
            "pkt_dts_time": "31.600000",
            "best_effort_timestamp": 790,
            "best_effort_timestamp_time": "31.600000",
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "3552780",
            "pkt_size": "2162",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "B",
            "coded_picture_number": 597,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_dts": 791,
            "pkt_dts_time": "31.640000",
            "best_effort_timestamp": 791,
            "best_effort_timestamp_time": "31.640000",
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "3549024",
            "pkt_size": "2580",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "B",
            "coded_picture_number": 596,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "3540824",
            "pkt_size": "7608",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "P",
            "coded_picture_number": 595,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_duration": 1,
            "pkt_duration_time": "0.040000",
            "pkt_pos": "3556118",
            "pkt_size": "7294",
            "width": 720,
            "height": 576,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "64:45",
            "pict_type": "P",
            "coded_picture_number": 598,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        }

This is running on my MacBook with OS 10.10.2.
See also attached test video.

At the end, some traces:

ffmpeg -v 9 -loglevel 99 -i test.avi
ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument 'test.avi'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file test.avi.
Successfully parsed a group of options.
Opening an input file: test.avi.
[avi @ 0x7f7f88807800] Format avi probed with size=2048 and score=100
[avi @ 0x7f7f88412fe0] use odml:1
[avi @ 0x7f7f88807800] Before avformat_find_stream_info() pos: 10960 bytes read:164864 seeks:4
[h264 @ 0x7f7f8880fe00] no picture
[avi @ 0x7f7f88807800] All info found
rfps: 24.750000 0.013325
    Last message repeated 1 times
rfps: 24.833333 0.005922
    Last message repeated 1 times
rfps: 24.916667 0.001481
    Last message repeated 1 times
rfps: 25.000000 0.000000
rfps: 25.083333 0.001481
    Last message repeated 1 times
rfps: 25.166667 0.005922
    Last message repeated 1 times
rfps: 25.250000 0.013325
    Last message repeated 1 times
rfps: 50.000000 0.000000
[avi @ 0x7f7f88807800] After avformat_find_stream_info() pos: 210341 bytes read:361472 seeks:4 frames:108
Input #0, avi, from 'test.avi':
  Metadata:
    title           : Fun Size - S��es oder Saures
    encoder         : Lavf56.25.101
    encoded_by      : www.onlinetvrecorder.com
  Duration: 00:00:31.68, start: 0.000000, bitrate: 908 kb/s
    Stream #0:0, 41, 1/25: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt470bg, left), 720x576 [SAR 64:45 DAR 16:9], 1/50, 701 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1, 67, 3/125: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 192 kb/s
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0x7f7f88412f20] Statistics: 361472 bytes read, 4 seeks

Change History (3)

comment:1 by martinr92, 9 years ago

Ok, file was to large for uploading it here.
https://www.dropbox.com/s/e239kmbzh5j9d3q/test.avi?dl=0

comment:2 by Carl Eugen Hoyos, 7 years ago

Keywords: read_intervals removed
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

Not a regression afaict / reproducible with f0606a28

in reply to:  2 comment:3 by Stefano Sabatini, 15 months ago

Resolution: fixed
Status: openclosed

Replying to Carl Eugen Hoyos:

Not a regression afaict / reproducible with f0606a28

Fixed in commit b6219c91144e665c98.

Note: See TracTickets for help on using tickets.