Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide example writing to container #2

Open
AlexanderHarrison opened this issue Feb 6, 2024 · 1 comment
Open

Provide example writing to container #2

AlexanderHarrison opened this issue Feb 6, 2024 · 1 comment

Comments

@AlexanderHarrison
Copy link

Hi, I'm having trouble figuring out all the settings I should send to the mp4 crate. Could you provide a small example on how to write encoded bytes to a container such as mp4?

For example, there was an issue on the inactive repo mentioning how you must trim the first 4 bytes off of the sps and pps fields when getting them from x264. I feel like an important detail such as that should be given an example. I also little understanding of the major_brand and minor version fields.

I would like to use higher-level apis and not deal with containers, but I only see the crate video-rs, which isn't too much less complicated and pulls in a bunch of unneeded dependencies. If there is another crate that can easily transform rgb bytes to video that would also be helpful.

Thanks!

@Stonks3141
Copy link
Owner

Unfortunately, in my experience, there simply are no good options when it comes to Rust APIs for video manipulation. If the overhead is acceptable for your use case, I would recommend creating images for each frame and shelling out to ffmpeg to produce a video. I wrote the bmff and mp4-stream crates a while ago, and while I'm not particularly proud of the APIs or code, they might be worth a try. I'm not very familiar with h264 internals like sps and pps, but if you'd like a copy of the (880 page) H.264 standard, I could send you that in private.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants