Add video format detection and support for 4:2:2 formats#63
Closed
mserajnik wants to merge 1 commit intom1k1o:masterfrom
Closed
Add video format detection and support for 4:2:2 formats#63mserajnik wants to merge 1 commit intom1k1o:masterfrom
mserajnik wants to merge 1 commit intom1k1o:masterfrom
Conversation
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.
Preface: I don't have much experience with Go, but this has worked for me and I figured I might as well open a PR for visibility. I don't plan on adjusting the PR. Feel free to take the code as is or use it as inspiration for a more proper implementation;
or simply close the PR if this is not something that is desirabe to have.Edit: I have closed the PR due to no reaction or feedback in over half a year, as I prefer not to keep open-ended responsibilities indefinitely.
I use go-transcode to be able to preview stock videos (many of them quite old and with now outdated video encoding) on the web as part of a larger media management system (for a custom-built DAM service). I ran into the issue that transcoding a video with a 4:2:2 format didn't work, because the
highpreset doesn't support 4:2:2 chroma subsampling. To fix this, I added basic video format detection and made it so that thehigh422profile is used if a video with any 4:2:2 format is detected.According to the ffmpeg docs the
high422profile only supportsyuv420p,yuv422p,yuv420p10leandyuv422p10le, which is something I only realized after looking up all the 4:2:2 formats I was able to find. I still kept all of them in theis422Formatcheck and using thehigh422profile might or might not work for them.