TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Writing an MP4 Muxer for Fun and Profit

95 点作者 skrrtww10 个月前

13 条评论

Andrews5475710 个月前
Having worked with some MP4 demuxing for my extension [1], I feel the pain. Lots of times I would play the video only to find inexplicable issues such as drifting audio. I highly recommend using an mp4 inspector tool, such as mp4box [2], to debug these issues.<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;Andrews54757&#x2F;FastStream">https:&#x2F;&#x2F;github.com&#x2F;Andrews54757&#x2F;FastStream</a><p>2: <a href="https:&#x2F;&#x2F;gpac.github.io&#x2F;mp4box.js&#x2F;test&#x2F;filereader.html" rel="nofollow">https:&#x2F;&#x2F;gpac.github.io&#x2F;mp4box.js&#x2F;test&#x2F;filereader.html</a>
评论 #41001297 未加载
somat10 个月前
Nice, when playing around one weekend trying to see if I could use ipfs as a transport layer for streaming video I got hung up because most video formats I tried behaved very poorly with inconsistent streams where you may not have the beginning. I ended up on mpeg-ts as the best behaving of the bunch. It felt a little weird, as I was sort of expecting something more modern to have better performance, but seeing as my goal was not to evaluate video formats but just ship them around I just accepted it and moved on.<p>Thinking back on it now, I just did a little trial and error until I found something that worked, but what would I search for if I was trying to find data on how... ?streamable? an encoding is?<p>If curious, I got my proof of concept working but it was unpleasantly slow. I blindly chunked the incoming stream into megabyte sized chunks registered the chunks on ipfs then used ipfs pubsub to announce the chunk to any watchers. The watcher would watch the pubsub channel for announcements download the chunk and try to reassemble it in order and play it. one neat side effect that I found was when the stream was done if I had stored all the ipfs address I could then generate a whole ipfs file structure you could use to download the stream at a later date.
CrendKing10 个月前
Can someone explain how does an existing media player understand the new mdat format without modification? I assume if they find a completed moov at end of the file, it would recognize the file as a unfragmented mp4. It should then try to find a list of recognized codecs directly inside the mdat (like in the first picture), but instead they will find another moov, a bunch of moofs and sub-mdats, all of which are clearly not proper for a unfragmented mp4. Why doesn&#x27;t the player report this as a &quot;unrecognizable, badly formatted&quot; mp4 file?
评论 #41001351 未加载
评论 #41001168 未加载
convivialdingo10 个月前
This is awesome work. I’ve coded some extensions for mp4 livestream to handling dozens of real-time streams and I’d love to try out the multi stream mux &#x2F; demux…
Retr0id10 个月前
&gt; It kind of hurts that several days of work and research can be summed up in a couple paragraphs, but that&#x27;s what the &quot;pain&quot; part in the subtitle is for.<p>Having recently written my own fragmented-MP4 remuxing library, I felt this pain too, and my soon-to-be-published writeup has very similar things to say about the ISO&#x27;s paywalling practices.<p>I think one of the hardest parts of ISO-BMFF, aside from spec availability, is that it&#x27;s pretty hard to implement &quot;cleanly&quot;, making existing code confusing to use as reference. (My own implementation is certainly not clean either)
评论 #41000543 未加载
评论 #41001092 未加载
mastax10 个月前
It looks like GStreamer has supported this for a few years: <a href="https:&#x2F;&#x2F;gstreamer.freedesktop.org&#x2F;documentation&#x2F;isomp4&#x2F;GstBaseQTMux.html?gi-language=c#GstBaseQTMux:fragment-mode" rel="nofollow">https:&#x2F;&#x2F;gstreamer.freedesktop.org&#x2F;documentation&#x2F;isomp4&#x2F;GstBa...</a><p>I always forget about GStreamer but I think I have a perfect application for it. Hopefully it’s easier to use as a library than MediaFoundation or FFMpeg.
akira250110 个月前
MP4. The answer to the question of &quot;Is there a way to make RIFF and AVI even worse somehow?&quot; It makes you genuinely pine for MPEG2 Transport Streams. ISO 13818 for life.
donpark10 个月前
Great work!<p>Would love to see MP4 Hybrid supported in popular packages like mp4-muxer [1] and mp4box [2] someday.<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;Vanilagy&#x2F;mp4-muxer">https:&#x2F;&#x2F;github.com&#x2F;Vanilagy&#x2F;mp4-muxer</a> 2: <a href="https:&#x2F;&#x2F;github.com&#x2F;gpac&#x2F;mp4box.js">https:&#x2F;&#x2F;github.com&#x2F;gpac&#x2F;mp4box.js</a>
Lammy10 个月前
&gt; moof (Movie Fragment Box)<p>Very cute easter egg. Moof is what dogcows say: <a href="http:&#x2F;&#x2F;clarus.chez-alice.fr&#x2F;history.php" rel="nofollow">http:&#x2F;&#x2F;clarus.chez-alice.fr&#x2F;history.php</a>
评论 #41000604 未加载
ogurechny10 个月前
So this is a “soft” sequential access limitation (we can tolerate some random writes to data as long as it is small enough and short enough). I wonder if there are formats that result in finished indexed multimedia file with “hard” sequential access, when nothing can be overwritten.
评论 #41001532 未加载
cornstalks10 个月前
(context, this is talking about fragmented MP4 downsides)<p>&gt; <i>2. They are slow to access on HDD or network drives, as each fragment&#x27;s header needs to be read to get the complete metadata of the file and start playback</i><p>Huh? That&#x27;s not right. The whole point of fragmented MP4 is that you can access any fragment without having to read the headers of the other fragments. That&#x27;s why adaptive streaming is built around fragmented MP4.
评论 #41001465 未加载
karolist10 个月前
&gt; Except there is no profit, only pain<p>I have 20 years or professional experience and my conclusion, if someone asked, what IT boils down to: pain.<p>The pain is what filters who can succeed and who fail. Can you endure hunting a bug for 7 hours in your chair? Can you fix problem after problem to get a system running? Everything that can fail, will fail, and you have to deal with it.
评论 #41000706 未加载
评论 #41001316 未加载
评论 #41000602 未加载
dylan60410 个月前
&quot;The new MP4 output now also supports multiple video tracks&quot;<p>MP4 has been able to have multiple video streams for quite some time. One of the very first advanced MP4 authoring tools I saw in the early 00s allowed for this, and we used it to make a few advanced files to demo the &quot;new&quot; MP4 format. Much like multi-angle DVDs, this was a niche feature that did not gain very much attraction. I could see why someone not around at that time might think this is a new feature, but it&#x27;s not
评论 #41000466 未加载