Dash.js: CHUNK_DEMUXER_ERROR_APPEND_FAILED: Video stream codec h264 doesn't match SourceBuffer codecs

Created on 3 Jul 2017  路  2Comments  路  Source: Dash-Industry-Forum/dash.js

I'm trying to play an mpd file generated using MP4Box command

MP4Box -dash 4000 -rap -frag-rap -sample-groups-traf -profile dashavc264:live -bs-switching no -segment-name dash_$Time$$ -url-template audio.mp4 joke-700k.mp4 joke-1000k.mp4 joke-1500k.mp4 joke-2000k.mp4 -out "dash_unprotected/manifest.mp4"

But dash.js is not playing the mpd file. Error being thrown is

[4439] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Video stream codec h264 doesn't match SourceBuffer codecs.)

However, when i generate mpd file from video segments
MP4Box -dash 4000 -rap -frag-rap -sample-groups-traf -profile dashavc264:live -bs-switching no -segment-name dash_$Time$$ -url-template joke-700k.mp4 joke-1000k.mp4 joke-1500k.mp4 joke-2000k.mp4 -out "dash_unprotected/manifest.mp4"

or from audio segment
MP4Box -dash 4000 -rap -frag-rap -sample-groups-traf -profile dashavc264:live -bs-switching no -segment-name dash_$Time$$ -url-template audio.mp4 -out "dash_unprotected/manifest.mp4"
It plays the mpd files. audio.mp4 is generated from from separating audio from video using the command below
ffmpeg -i joke.mp4 -an -flags:v +global_header -vcodec copy video.mp4 ffmpeg -i joke.mp4 -vn -flags:a +global_header -acodec libvo_aacenc audio.mp4

All the video segments are generated from producing different bitrates from video.mp4 as shown below

ffmpeg -i 'video.mp4' -c:v libx264 -preset veryslow -profile:v high -level 4.2 -b:v 2000k -minrate 2000k -maxrate 2000k -bufsize 4000k -g 96 -keyint_min 96 -sc_threshold 0 -filter:v "scale='trunc(oh*a/2)*2:576'" -pix_fmt yuv420p joke-2000k.mp4
ffmpeg -i 'video.mp4' -c:v libx264 -preset veryslow -profile:v high -level 4.2 -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3000k -g 96 -keyint_min 96 -sc_threshold 0 -filter:v "scale='trunc(oh*a/2)*2:480'" -pix_fmt yuv420p joke-1500k.mp4
ffmpeg -i 'video.mp4' -c:v libx264 -preset veryslow -profile:v high -level 4.2 -b:v 1000k -minrate 1000k -maxrate 1000k -bufsize 2000k -g 96 -keyint_min 96 -sc_threshold 0 -filter:v "scale='trunc(oh*a/2)*2:360'" -pix_fmt yuv420p joke-1000k.mp4
ffmpeg -i 'video.mp4' -c:v libx264 -preset veryslow -profile:v high -level 4.2 -b:v 700k -minrate 700k -maxrate 700k -bufsize 1400k -g 96 -keyint_min 96 -sc_threshold 0 -filter:v "scale='trunc(oh*a/2)*2:288'" -pix_fmt yuv420p joke-700k.mp4

Based on the information above, how can i solve the error?

Most helpful comment

@bbcrddave I was finally able to solve the problem. the issue was in -segment-name dash_$Time$$ option of MP4Box.
In my -url-template option, i have provided video templates and an audio template. When video segments are being produced, they are named like dash_$1.m4s , dash_$2.m4s , dash_$3.m4s e.t.c
Now, when audio segments are being produced, they are named the same way as video segments that is, they are named dash_$1.m4s , dash_$2.m4s e.t.c So guess what, video segments are being overwritten! So when i try to play my manifest.mpd file, i get the error

[4439] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Video stream codec h264 doesn't match SourceBuffer codecs.)

Solutiion
My solution was to remove -segment-name option so that MP4Box will give all segments their names in correct way without one segment being overwritten by the other. At the end, my segments were named correctly
audio_dash1.m4s, audio_dash2.m4s, audio_dash3.m4s e.t.c
video-700k_dash1.m4s, video-700k_dash2.m4s, video-700k_dash3.m4s e.t.c
video-1000k_dash1.m4s, video-1000k_dash2.m4s, video-1000k_dash3.m4s e.t.c

Now when i try to play manifest.mpd in dash.js, it played very very well.

All 2 comments

This looks very similar to the problem you reported in https://github.com/Dash-Industry-Forum/dash.js/issues/2041#issuecomment-311861334.

Can you share the manifest?

@bbcrddave I was finally able to solve the problem. the issue was in -segment-name dash_$Time$$ option of MP4Box.
In my -url-template option, i have provided video templates and an audio template. When video segments are being produced, they are named like dash_$1.m4s , dash_$2.m4s , dash_$3.m4s e.t.c
Now, when audio segments are being produced, they are named the same way as video segments that is, they are named dash_$1.m4s , dash_$2.m4s e.t.c So guess what, video segments are being overwritten! So when i try to play my manifest.mpd file, i get the error

[4439] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Video stream codec h264 doesn't match SourceBuffer codecs.)

Solutiion
My solution was to remove -segment-name option so that MP4Box will give all segments their names in correct way without one segment being overwritten by the other. At the end, my segments were named correctly
audio_dash1.m4s, audio_dash2.m4s, audio_dash3.m4s e.t.c
video-700k_dash1.m4s, video-700k_dash2.m4s, video-700k_dash3.m4s e.t.c
video-1000k_dash1.m4s, video-1000k_dash2.m4s, video-1000k_dash3.m4s e.t.c

Now when i try to play manifest.mpd in dash.js, it played very very well.

Was this page helpful?
0 / 5 - 0 ratings