Fix HEVC hvc1 tagging: set stream codec_tag and cover all HEVC encoders#154
Open
AlvinShenSSW wants to merge 1 commit into
Open
Fix HEVC hvc1 tagging: set stream codec_tag and cover all HEVC encoders#154AlvinShenSSW wants to merge 1 commit into
AlvinShenSSW wants to merge 1 commit into
Conversation
The existing hvc1 tagging set the tag via stream.options['tag'], but PyAV/ ffmpeg treats that as an encoder private option and silently ignores it, so HEVC output in ISOBMFF containers (mp4/mov/m4v) stayed tagged 'hev1'. Apple's AVFoundation (Finder thumbnails, QuickLook, QuickTime, Safari) rejects 'hev1'. Verified with PyAV 16.1.0: stream.options['tag']='hvc1' yields 'hev1', while stream.codec_tag='hvc1' yields 'hvc1'. Set codec_tag on the stream instead so the muxer FourCC is actually written, and apply it to all HEVC encoders (libx265, hevc_nvenc, hevc_amf, hevc_qsv, hevc_videotoolbox), not just hevc_videotoolbox. Metadata-only change; non-Apple players accept both tags.
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.
Problem
HEVC output in ISOBMFF containers (mp4/mov/m4v) is tagged
hev1, which Apple's AVFoundation rejects — no Finder thumbnails / QuickLook previews, and no playback in QuickTime or Safari. The intended tag ishvc1.The current code sets this through the encoder options dict:
But PyAV/ffmpeg treats
stream.optionsas encoder private options and silently ignores an unknowntagkey, so the output stayshev1. (#153 widens this to all HEVC encoders but keeps the same ineffective mechanism, so it doesn't actually change the tag either.)Verification (PyAV 16.1.0)
codec_tag_stringstream.options['tag'] = 'hvc1'hev1❌stream.codec_tag = 'hvc1'hvc1✅hev1Confirmed end-to-end through
VideoWriterwith bothlibx265andhevc_nvenc: the muxed output goes fromhev1tohvc1.Fix
Set the tag via the stream's
codec_tag(the muxer FourCC) instead of encoder options, and apply it to all HEVC encoders (libx265,hevc_nvenc,hevc_amf,hevc_qsv,hevc_videotoolbox) when writing mp4/mov/m4v. Metadata-only change; non-Apple players accept both tags.Supersedes #153.