Automatic MP4 muxing without external tools#441
Automatic MP4 muxing without external tools#4415p4k wants to merge 3 commits intowaveform80:masterfrom
Conversation
|
Fascinating! Many thanks for the PR - proper MP4 muxing has been something I've been dying to research for picamera for ages but it's always been too big a job to start on top of everything else. Unfortunately, the external dependency this adds (pymp4) complicates things as it's not debian/raspbian packaged which means this'd break the primary means by which picamera is distributed (i.e. as a .deb package in raspbian). However, this is sufficiently interesting that it might be worth adding as an optional dependency for pip-based installs. I'll have a deeper dig into the PR for 1.14; I can't promise I'll include it yet, but it's definitely very interesting. Many thanks for the PR, and sorry it's taken so long to get around to looking at it! |
|
Sounds good! Let me know if there is something that I can contribute with for this merge. In the past year I’ve been using this extensively with no issues. Having it as a pip optional dep would be nice; re-implementing all those atoms required by MP4 is quite some effort. |
Hello! This is a minimal implementation of a MP4 muxer directly in python, so we do not need a second pass through
ffmpegoravconv. This introduces a dependency frompymp4and, through that, fromconstruct.To use it, just record to a
.mp4file or useformat='mp4'. I tested this in several ways in on a Raspberry Pi 2 model B (this started actually as a separate project), and so far I had no issue.What is missing:
stscatomRegarding the last item, I think that, formally, every time a different SPS header is issued together with a keyframe, we should specify a new chunk in there. Also, although it seems that the SPS/PPS parameters are usually always the same, perhaps we should allocate a different sample descriptor for those chunks. Nevertheless, the current one-chunk approach was playable on all platforms and all players I could get my hands on.