I want to encode from any source to a universally playable .mpd with h264 codec.
Here my command
/usr/bin/ffmpeg -re -i 1.webm -c:v libx264 -preset ultrafast
-tune zerolatency -c:a aac -ac 2 -strict -2 -crf 18 -profile:v baseline
-maxrate 1000k -pix_fmt yuv420p -flags -global_header -streaming 1
-use_template 1 -use_timeline 0 -seg_duration 2 -remove_at_exit 1
-f dash index.mpd
but with dash.js the log says
dash.js videoCodec (video/mp4;codecs="avc1") is not supported.
**EXTRA NOTE: When using -c:v libx264 and output in HLS .m3u8 --> it's working in all browsers
HTML with dash.js
<script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>
<center><video width="90%" height="600" id="videoPlayer" controls=""
src="" playsinline="true" preload="metadata" ></video></center>
<script>
(function(){
var url = "https://www.---domain--path-to.mpd";
var player = dashjs.MediaPlayer().create();
player.initialize(document.querySelector("#videoPlayer"), url, true);
player.updateSettings({
streaming: {
lowLatencyEnabled: true,
liveDelay: 4,
liveCatchup: {
minDrift: 0.02,
maxDrift: 0,
playbackRate: 0.5,
latencyThreshold: 60
}
}
});
})();
video = document.getElementById("videoPlayer");
video.addEventListener("loadedmetadata", function(){ video.muted = true; video.play(); }, false);
</script>
I do have "-c:v libx264" but why dash.js sees avc1... I know that h264 have avc1, but how to fix this. Is it fixing the ffmpeg command or changing the player.initialize
in the javascript
video/mp4;codecs="avc1"
isn't a valid codecstring - it's missing the profile, constraints and level that are required by the SourceBuffer for this bitstream type.
It's happening because you have -flags -global_header
set. This is causing the codec extradata to be unset, which in turn means that the ffmpeg DASH manifest generator cannot generate the correct codecstring.
Remove -flags -global_header
and it should work fine.