mpc-hc.org | The source code of our website | Web Site library
kandi X-RAY | mpc-hc.org Summary
kandi X-RAY | mpc-hc.org Summary
The source code of our website.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mpc-hc.org
mpc-hc.org Key Features
mpc-hc.org Examples and Code Snippets
Community Discussions
Trending Discussions on mpc-hc.org
QUESTION
Iam using OpenH264 as encoder and I want to mux its output into a playable mp4 using libmp4v2
The resulting .mp4
only work partially. It is playable in VLC and MPC-HC but not in Windows Media Player nor the Windows 10 "Movie and Tv" App.
My goal is it that the file works with all these players.
Both Windows players are telling my they don't know the codec so they can't play it back:
This is not really true since I can play a manually muxed file using the same h264 bitstream by using FFmpeg from the cli:
ANSWER
Answered 2018-Mar-26 at 09:55You can use MP4Box from GPAC to analyze the MP4 box layouts of both files. As seen here, the bad file is missing the SPS/PPS data in the avcC box. The same NAL units are most likely stored in the NAL units as well, but the specification requires them to be also present in the avcC box (some players handle SPS/PPS inlined in the stream but that is a bad practice since it breaks seeking and what not since you don't know which sample groups reference which parameter sets upfront).
A quick google search for libmp4v2 gave me this example which shows how to actually call MP4AddH264SequenceParameterSet
/MP4AddH264PictureParameterSet
to provide the SPS/PPS, while you only call MP4WriteSample
which could be the issue.
My subjective opinion - I have never used libmp4v2 but if you don't know how to use it too just use ffmpeg instead - more examples and the community will be bigger. Muxing H.264 into mp4 is quite simple, again lots of examples on the internet.
SUMMARY
- MP4 requires the SPS/PPS information to be in the
avcC
box - some players may be able to decode the stream if these units are put inline with the samples, but to conform to the specification, one should always have theavcC
box present, otherwise a player is free to fail to play the stream. - Depending on the library used, there may be different techniques how to signal the SPS/PPS to the muxer, but as seen here with libmp4v2, one must use
P4AddH264SequenceParameterSet/MP4AddH264PictureParameterSet
. To obtain the SPS/PPS data one should parse the bitstream. This varies depending on the bitstream format (if annex b format with start codes or avcc format with interleaved lengths are used - see this for more info). When the SPS/PPS info is extracted it should be passed to the muxing library. - Handle SPS/PPS change with care. The specification actually states that you can have multiple
stsd
stream description boxes and then reference them, but as far as I recall, Windows Media Player handles this poorly, so if possible stick to a single SPS/PPS set. One should be able to configure the encoder not to emit duplicate SPS/PPS entries on each keyframe.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mpc-hc.org
Install grunt: npm install -g grunt-cli
Install the Node.js dependencies via npm: cd mpc-hc.org and then npm install
Install Ruby with DevKit
Run gem install bundle and then bundle install
Run grunt build to build the static site, grunt to build and watch for changes (http://localhost:8000/). Run grunt --help to see all the available tasks.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page