Repository navigation
Conversation
Preserve AV_PKT_DATA_SPHERICAL across codec parameter copying in FFmpegWriter when using libavformat 61 or newer. Add MP4 structural regression coverage for positive, zero, and negative yaw, pitch, and roll values.
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.
Summary
Fixes the loss of spherical video metadata when exporting MP4 files using FFmpeg 7.
The change preserves spherical coded side data across codec parameter initialization, ensuring that exported MP4 files retain their spherical projection and orientation information.
Root cause
On FFmpeg 7,
FFmpegWriter::AddSphericalMetadata()attachesAV_PKT_DATA_SPHERICALto the output stream'scodecpar->coded_side_data.A subsequent call to
avcodec_parameters_from_context()duringFFmpegWriter::open_video()clears the previously attached coded side data.Consequently, the spherical metadata is lost before the MP4 muxer writes the output file.
Fix
avcodec_parameters_from_context()completes.Regression testing
Added
tests/SphericalMetadata.cpp, which independently inspects MP4sv3d/proj/prhdboxes and verifies the exported orientation metadata.Tested orientations:
Environment: GCC 15, FFmpeg 7.1.1, Linux.
Result: All 12 assertions passed in 1 test case.
The complete libopenshot build also succeeded.
Scope
This is an independent fix based directly on
OpenShot/libopenshot:develop. It does not depend on PR #1088.Related to #1083.