Conversation
|
@pletessier Thanks for the PR. The changes looks good for me. Could you add simple test for the feature? The simplest solution I see is to use some existing video in opencv_extra, restrict FFmpeg provide key frames only with |
|
Hi @asmorkalov, Setting it in my shell before to run the test is breaking some tests using FFMpeg. That was expected. Is there another approach I could try ? |
|
|
|
@asmorkalov Starting from a clean env, it works fine now ! |
|
@asmorkalov Windows tests are failing. Probably because of #9292 (comment). I can't test on Windows. I am not even sure that the |
asmorkalov
left a comment
There was a problem hiding this comment.
@pletessier I have Windows host in my hands and will check it in mean time. Thanks for the test!
|
Hello @pletessier , I found out the failure reason. OpenCV links FFMPEG using wrapper code to prevent license conflict. When the library is built on Unix and wrapper code is built together with the library as we do not distribute FFMPEG itself. On Windows the wrapper is built as dedicated library and is loaded on the go, if FFMPEG is present in the distribution. Wrapper is built and updated manually and CI just uses old version of the wrapper lib without your skip option. |
|
👍 |
|
@pletessier Please clean up test code and we can merge the path and update pre-built libs after it. |
|
👍 |
|
@pletessier Could you squash your commits to have clean library commit history. |
|
You need to skip Windows tests for now (until FFmpeg wrapper got new update) - we can't merge with red builders. Add this guard for test code: |
| else if (strcmp(avdiscard_entry->value, "nonkey") == 0) | ||
| enc->skip_frame = AVDISCARD_NONKEY; | ||
| else if (strcmp(avdiscard_entry->value, "nonref") == 0) | ||
| enc->skip_frame = AVDISCARD_NONREF; |
There was a problem hiding this comment.
What FFmpeg / libav versions support that? (at least compilation)
Need to properly guard code through "#if"s.
BTW, access to OPENCV_FFMPEG_CAPTURE_OPTIONS is guarded by
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
There was a problem hiding this comment.
@alalek All options (except AVDISCARD_NONINTRA) are in use since ffmpeg 0.7 (libavcodec 52.123.0)
First use of AVDISCARD_NONINTRA is in version 2.3 (libavcodec 55.69.100).
I added some checks on LIBAVCODEC_BUILD version in my last commit, and squashed previous ones.
fa3f3ec to
20f5063
Compare
|
👍 |
|
@alalek Could you take a look and merge the patch? |
|
Rebased on 3.4 branch and "disabled" test:
|
This pullrequest changes
Add the possibility to skip frames in VideoCapture by using the existing
OPENCV_FFMPEG_CAPTURE_OPTIONSenvironment variable and theAVCodecContext::skip_framemethod.AVDiscard options are :
AVDISCARD_NONE : discard nothing
AVDISCARD_DEFAULT : discard useless packets like 0 size packets in avi
AVDISCARD_NONREF : discard all non reference
AVDISCARD_BIDIR : discard all bidirectional frames
AVDISCARD_NONKEY : discard all frames except keyframes
AVDISCARD_ALL : discard all
For example, if you want VideoCapture to capture only keyframes, you can set the env var :
OPENCV_FFMPEG_CAPTURE_OPTIONS=avdiscard;nonkey