Opened 12 years ago

Closed 12 years ago

#1859 closed enhancement (fixed)

feature request: making skip_stream work with ffprobe

Reported by: Vineet Goel Owned by:
Priority: wish Component: ffprobe
Version: git-master Keywords: skip_frame
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I can extract "video stream" frame information using ffprobe

% ffprobe -select_streams v -show_frames -print_format json 1280x720_Shinkarenko-Gonzalez.mp4 > allframe-info.txt

But if i further add "-skip_frame nokey" to above command

% ffprobe -skip_frame nokey -select_streams v -show_frames -print_format json 1280x720_Shinkarenko-Gonzalez.mp4 > keyframe-info.txt

It doesn't make any difference to the output. What I am trying to is extract keyframe info. I get this data from first command. But then the output file contains detail of all frames and I have to filter out text file. Moreover, I feel that using skip_frame will speed up the result I need.

Attachments (1)

output.log (921.6 KB ) - added by Vineet Goel 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: ffprobe removed
Priority: normalwish
Reproduced by developer: set
Status: newopen
Version: git-master

For future tickets: Please always provide the command line together with complete, uncut console output.

I can confirm that the following command line does not execute faster than without -skip_frame nokey and takes nearly as long as ffmpeg -i Vertical400kbit.sorenson3.mov -f null - (while ffmpeg -skip_frame nokey is significantly faster).

$ ffprobe -skip_frame nokey -select_streams v -show_frames fate-suite/svq3/Vertical400kbit.sorenson3.mov >test
ffprobe version N-46093-g14f69a0 Copyright (c) 2007-2012 the FFmpeg developers
  built on Oct 28 2012 13:17:25 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52.  1.100 / 52.  1.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 35.100 / 54. 35.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.106 /  3. 20.106
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1baddc0] max_analyze_duration 5000000 reached at 5000998
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
  Metadata:
    creation_time   : 2001-03-20 16:17:18
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Sorenson Video 3
    encoder-eng     : Sorenson Video 3
  Duration: 00:00:43.57, start: 0.000000, bitrate: 580 kb/s
    Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p, 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, 1 channels, s16p, 176 kb/s
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler

comment:2 by Vineet Goel, 12 years ago

Thanks, but "-skip_frame nokey" does not work even with ffmpeg!

When I run following command:
ffprobe -select_streams v -show_frames -print_format json 1280x720_Shinkarenko-Gonzalez.mp4 > allframe-info.txt

ffprobe version 1.0.git Copyright (c) 2007-2012 the FFmpeg developers
  built on Oct 28 2012 09:10:45 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/usr/local --enable-libx264 --enable-libfaac --enable-gpl --enable-shared --enable-nonfree --enable-libvorbis --enable-libvpx --disable-ffserver --disable-doc --enable-bzlib --enable-zlib
  libavutil      52.  0.100 / 52.  0.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 34.100 / 54. 34.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.105 /  3. 20.105
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1280x720_Shinkarenko-Gonzalez.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.94.0
  Duration: 00:07:36.22, start: 0.000000, bitrate: 3470 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3298 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 165 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler

My allframe-info.txt has info has 13673 frames info in following json format:

    "frames": [
        {
            "media_type": "video",
            "key_frame": 1,
            "pkt_pts": 0,
            "pkt_pts_time": "0.000000",
            "pkt_dts": 0,
            "pkt_dts_time": "0.000000",
            "pkt_duration": 1001,
            "pkt_duration_time": "0.033367",
            "pkt_pos": "48",
            "width": 1280,
            "height": 720,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "1:1",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0,
            "reference": 3
        },
        {
            "media_type": "video",
            "key_frame": 0,
            "pkt_pts": 1001,
            "pkt_pts_time": "0.033367",
            "pkt_dts": 1001,
            "pkt_dts_time": "0.033367",
            "pkt_duration": 1001,
            "pkt_duration_time": "0.033367",
            "pkt_pos": "121676",
            "width": 1280,
            "height": 720,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "1:1",
            "pict_type": "B",
            "coded_picture_number": 2,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0,
            "reference": 0
        },
....
....
....
    ]
}


And there are 55 video frames where "key_frame": 1 in the json data file.
By this logic using "-skip_frame nokey" additional parameter to above command, I should get only those 55 keyframes' json info in my text file

so my command line becomes:
ffprobe -skip_frame nokey -select_streams v -show_frames -print_format json 1280x720_Shinkarenko-Gonzalez.mp4 > keyframe-info.txt

ffprobe version 1.0.git Copyright (c) 2007-2012 the FFmpeg developers
  built on Oct 28 2012 09:10:45 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/usr/local --enable-libx264 --enable-libfaac --enable-gpl --enable-shared --enable-nonfree --enable-libvorbis --enable-libvpx --disable-ffserver --disable-doc --enable-bzlib --enable-zlib
  libavutil      52.  0.100 / 52.  0.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 34.100 / 54. 34.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.105 /  3. 20.105
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1280x720_Shinkarenko-Gonzalez.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.94.0
  Duration: 00:07:36.22, start: 0.000000, bitrate: 3470 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3298 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 165 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler

But my keyframe-info.txt file again contains 13673 frames instead of 55 keyframes
So "skip_frame nokey" is not working. Is this a bug?

in reply to:  2 comment:3 by Carl Eugen Hoyos, 12 years ago

Replying to vineet156:

Thanks, but "-skip_frame nokey" does not work even with ffmpeg!

It works fine here, could you elaborate?
(Please provide the ffmpeg command line you tested together with complete, uncut console output.)

by Vineet Goel, 12 years ago

Attachment: output.log added

comment:4 by Vineet Goel, 12 years ago

This is my command line.
ffmpeg -skip_frame nokey -i 1280x720_Shinkarenko-Gonzalez.mp4 -vf showinfo='iskey' -f null -

complete uncut output is attached: output.log

each and every frame is shown via showinfo, while all nonkey frame should have been skipped from input itself. You can see that only 55 frames have "iskey:1" in output.log

in reply to:  4 comment:5 by Carl Eugen Hoyos, 12 years ago

Replying to vineet156:

This is my command line.
ffmpeg -skip_frame nokey -i 1280x720_Shinkarenko-Gonzalez.mp4 -vf showinfo='iskey' -f null -

But can't you confirm that there is a tiny, tiny speed difference between the following two commands:

$ time ffmpeg -skip_frame nokey -i 1280x720_Shinkarenko-Gonzalez.mp4 -vf showinfo='iskey' -f null test1
$ time ffmpeg -i 1280x720_Shinkarenko-Gonzalez.mp4 -vf showinfo='iskey' -f null test2

indicating that -skip_frame nokey is working as expected with ffmpeg?

The way I understand your original report is that you want to see the same speed gain with ffprobe than with ffmpeg, if you just don't want to see the output, at least with ffmpeg you can use the select filter.

comment:6 by Vineet Goel, 12 years ago

I sent a reply 3 days back itself. But today, I received a auto generated mail saying "Delay in mail delivery". Somehow reply via email not reaching the trac server.
Anyways, I am updating my reply from the website now. here it goes...
=======================================================================

May be there is a negligible time difference. But the reason behind using "skip_frame nokey" was to show only show "iskey:1" frames via select filter (if using ffmpeg)

similarly, with ffprobe if "skip_frame nokey" should only generate those 55 key frame's information in json

So, somewhere it's not working as per the documentation

Just to clarify, I was not looking at speed gain.
All I am trying to do is extract info about each keyframe present in a source video.
I thought using "skip_frame nokey" I'll get just the keyframe information in my output.

Additionally, if I may add, what should be best method to extract the image from each keyframe from my source video?
coz following command generate image for each video frame instead of just keyframes

ffmpeg -skip_frame nokey -i 1280x720_Shinkarenko-Gonzalez.mp4 -f image2 - images/keyframes%03d.jpg

ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 28 2012 09:10:45 with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/usr/local --enable-libx264 --enable-libfaac --enable-gpl --enable-shared --enable-nonfree --enable-libvorbis --enable-libvpx --disable-ffserver --disable-doc --enable-bzlib --enable-zlib
  libavutil      52.  0.100 / 52.  0.100
  libavcodec     54. 69.100 / 54. 69.100
  libavformat    54. 34.100 / 54. 34.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 20.105 /  3. 20.105
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1280x720_Shinkarenko-Gonzalez.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.94.0
  Duration: 00:07:36.22, start: 0.000000, bitrate: 3470 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3298 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 165 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Output #0, image2, to 'images/keyframes%03d.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.34.100
    Stream #0:0(und): Video: mjpeg, yuvj420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
[h264 @ 0xecf420] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xe8a5a0] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x1005400] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xf9de80] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xf36900] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xecf420] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xe8a5a0] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x1005400] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0xf9de80] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
.......
.......
.......

I hope you also saw the output.log attachement

Last edited 12 years ago by Vineet Goel (previous) (diff)

comment:7 by Vineet Goel, 12 years ago

Hi,
sorry I am being little impatient, but did you receive my reply. My earlier reply via email bounced back after few days with failed mail delivery.
Is the above issue a bug or am I missing something?

Thanks a lot

in reply to:  7 comment:8 by Stefano Sabatini, 12 years ago

Analyzed by developer: set
Resolution: fixed
Status: openclosed

Replying to vineet156:

Hi,
sorry I am being little impatient, but did you receive my reply. My earlier reply via email bounced back after few days with failed mail delivery.

Is the above issue a bug or am I missing something?

No it was a missing (important) feature.

Should be fixed in:

commit 1019cef329b508f0a9033b355cc18bf8026caf31
Author: Stefano Sabatini <stefasab@gmail.com>
Date:   Thu Mar 7 00:47:59 2013 +0100

    ffprobe: support codec options
    
    Make ffprobe honour codec options, and support stream specifiers like it
    is done in ffplay.
    
    In particular, address Trac ticket #1859.
Note: See TracTickets for help on using tickets.