Skip to content

Find muxer options in VideoEncoder to test fragmented mp4#1216

Open
Dan-Flores wants to merge 7 commits intometa-pytorch:mainfrom
Dan-Flores:fragmented_mp4_perhaps
Open

Find muxer options in VideoEncoder to test fragmented mp4#1216
Dan-Flores wants to merge 7 commits intometa-pytorch:mainfrom
Dan-Flores:fragmented_mp4_perhaps

Conversation

@Dan-Flores
Copy link
Contributor

@Dan-Flores Dan-Flores commented Feb 2, 2026

This PR adds logic to sortCodecOptions to find and set muxer options (check available options with ffmpeg -h muxer=mp4)

With these changes, we can now test that fragment related movflag options are utilized correctly.
But, without a 'streaming' video encoder, the benefits of fragmented mp4's are still not unlocked:

  • Fragmented MP4s are useful because they allow the video file to be consumed before it is closed.
  • However, since our encoder expects all frames to be encoded at once, the fragments are not flushed to become available to consume until the end of the encoding process, so we cannot access the video before encoding is completed.

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 2, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1216

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 4b4bf72 with merge base 06d4538 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 2, 2026
@Dan-Flores Dan-Flores marked this pull request as ready for review February 3, 2026 20:34
// https://github.com/FFmpeg/FFmpeg/blob/n8.0/libavformat/movenc.c#L8666
if (status > 0) {
status = AVSUCCESS;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this conversion, we interpret the positive returned integer as a random low level error unrelated to the encoding process (ex. 24 raises EMFILE: too many open files). It might just be a bug in the FFmpeg implementation that we can work around.

Since FFmpeg errors are negative, I think its fine to set the status to successful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant