Fix video codec fourcc #21101#22333
Merged
asmorkalov merged 2 commits intoopencv:4.xfrom Aug 26, 2022
Merged
Conversation
alalek
approved these changes
Aug 26, 2022
Contributor
|
Related changes for cudacodec: opencv/opencv_contrib#3340 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should fix #21101 in most cases by returning a valid fourcc from
CvCapture_FFMPEG::getProperty(CAP_PROP_FOURCC)whencodec_tag==0and_opencv_avcodec_get_name(codec_id)is invalid. Previously as noted in the issuegetPropertywould have returned 0.In addition to the description in #21101, it appears that the value of
video_st->CV_FFMPEG_CODEC_FIELD->codec_tagdepends on the video file itself and not just the codec used. That is some vp9 video's will have a valid codec_tag and some will have zero. As a result all of the test cases apart from "../cv/tracking/faceocc2/data/faceocc2.webm" would have worked before this change and are included to verify that the previous functionality still works.Futhermore with reference to the question of which fourcc to return for vp8[9] and av1. Unfortunately because codec_tag could be valid we have no control over the return value from
getPropertywithout breaking the fourcc's which are already returned. E.g. the value ofvideo_st->CV_FFMPEG_CODEC_FIELD->codec_tagfor a vp9 file could be vp09, vp90, VP09, VP90 or zero, and in the first four cases forcing a return value of VP90 would break existing code relying on the return value fromgetProperty.Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.