Chunk demuxer error append failed как исправить
Перейти к содержимому

Chunk demuxer error append failed как исправить

  • автор:

How to fix CHUNK_DEMUXER_ERROR_APPEND_FAILED error when append chunk?

I want to create a video player that can play multiple resolution, so I have to load chunks of different codecs. I tried to append chunk of the same codec and it work. So I tried to use changeType() but when I append the new codec chunk in the video element I found this error «CHUNK_DEMUXER_ERROR_APPEND_FAILED: Append: stream parsing failed.».

const myMediaSource = new MediaSource(); var videoSourceBuffer; var quality=480,qlast=480; var currentSegment = 0; var loading = false; function videos() < myMediaSource.addEventListener('sourceopen', sourceOpen, < once: true>); > function sourceOpen() < setInterval(feedVideo, 500); >function feedVideo() < if (!loading) < try < if (myMediaSource.sourceBuffers.length == 0) < videoSourceBuffer = myMediaSource.addSourceBuffer('video/mp4; codecs="avc1.64001E,mp4a.40.2"'); appendSegment("cinit.mp4", 0); first = true; >else < if (qlast != quality) < videoSourceBuffer = myMediaSource.sourceBuffers[0]; if (quality == 1080) < type = 'video/mp4; codecs="avc1.640028,mp4a.40.2"'; >else if (quality == 720) < type = 'video/mp4; codecs="avc1.64001F,mp4a.40.2"'; >else if (quality == 480) < type = 'video/mp4; codecs="avc1.64001E,mp4a.40.2"'; >else if (quality == 360) < type = 'video/mp4; codecs="avc1.64001E,mp4a.40.2"'; >videoSourceBuffer.changeType(type); videoSourceBuffer.mode = "segments"; qlast = quality; > > if (!first) < appendSegment("c" + currentSegment + ".m4s", currentSegment); >else < first = false; >> catch (error) < console.log('Error! ' + error); >> > function appendSegment(file, resourcesIndex) < loading = true; fetch("http://mysite/video/" + quality + "p/" + file).then(function (response) < return response.arrayBuffer(); >).then(function (videoData) < videoSourceBuffer.appendBuffer(videoData); videoSourceBuffer.addEventListener('updateend', function () < loading = false; >, < once: true >); >); > 

Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming live h264 video using mp4frag #4

karlbrowns opened this issue Dec 3, 2019 · 1 comment

Streaming live h264 video using mp4frag #4

karlbrowns opened this issue Dec 3, 2019 · 1 comment

Comments

karlbrowns commented Dec 3, 2019

Hi Kevin,
I want to stream a live h264 stream to a web browser video panel. I’m already using node for the web server, and ffmpeg to turn the h264 stream to fragmented mp4, and then I found your mp4frag module. The issue I have at the moment without mp4frag is that I feed the ffmpeg data into node via a UDP port, and whenever this gets some data it writes it out on the wss socket to the browser. However, as it comes in in small chunks, the browser tries to add the buffer received to the mediasource sourceBuffer and this fails with a CHUNK DEMUXER ERROR APPEND FAILED error.
I’m running this on an embedded system, so don’t have vast amounts of storage available, and don’t want the latency of HLS. Is it possible to get mp4frag to send the stream to MSE one frame at a time? How would I configure it to do this?
Many thanks,
Simon

The text was updated successfully, but these errors were encountered:

Как правильно хостить и проигрывать видео в 2020?

Добрый вечер!
Мы недавно реализовали проект фестиваля, на сайте которого можно было посмотреть полнометражные фильмы.
В целом все прошло хорошо, но сейчас очень остро стоит вопрос относительно технологий которые для этого использовались, потому что очень явно ощущается, что что-то пошло не так, а на горизонте уже маячат похожие проекты.

Начитавшись того, как «правильно» должна выглядеть подобная реализация, решили заюзать эпловский HLS.
Конвертнули все видео-дорожки для разного качества при помощи ffmpeg. Разбили все файлы на видео-аудио дорожки при помощи mediafilesegmenter, mediasubtitlesegmenter — создали плейлисты при помощи variantplaylistcreator.
Получили класный master.m3u8 файл плейлиста, где все эти конфиги были красиво описаны.
И вроде бы на клиенте получаем полностью работоспособную систему, которая отлично работает. но не тут то было.

Когда на проект запустили пользователей — массово посыпались жалобы, у кого-то не грузит видео, кто-то ловит ошибки декода (chunk_demuxer_error_append_failed append stream parsing failed) у кого-то видео зависает на каких-то этапах и на отказ перестает грузиться. Это при том, что в первый день онлайн был не более 200 одновременных просмотров, а нагрузка по трафику из доступных 3гб\сек не превышала и 1\3.
Другими словами, пошла какая-то лажа.

Так как делать нужно было что-то срочно, решили от m3u8 файлов отказаться и перейти на отдачу цельных файлов сразу. В конфигах просто прописали ссылки на mp4 файлы, в которых сразу находилось всего одна аудио и видео дорожка. И чудо — все ошибки сразу пропали.
То есть получается, что отдача одним файлом и браузерный декод, вышли намного эффективнее чем то, что мы делали через HLS. ¯\_( ツ)_/¯

Мы посмотрели кучу стриминговых сервисов, большая часть из них отдавала все свои стримы в формате m3u8, и никаких проблем при этом люди не испытывали. Соответственно назрела куча вопросов о том, как таки стоит делать и в чем могла быть ошибка и как это исправить на будущее.

1) Как правильно хостить файлы на сервере? Нужна ли разбивка при помощи HLS\DASH? Где-то видел что эти технологии нужно использовать в паре, так как каждая из них имеет свою браузерную поддержку.

2) Должны ли быть на сервере какие-то специфичные настройки, для эффективной отдачи статического медиа-контента?

3) Медиа-плеер. Возможно, причина ошибок связана с плеером, который использовали на клиенте? Мы использовали https://flowplayer.com/.
Наслышан о таких плеерах, как Movie.js Shaka Player, jwplayer — возможно есть смысл попробовать какой-то из них? Плеер не обязательно бесплатный, просто хочется использовать технологию, которая сможет дать максимальное покрытие. Например, в этом проекте, люди заходили с телевизора, а на tizen flowplayer не работал, от слова совсем.

4) Шифрование\защита файлов. Как по мне отдача чистых mp4 файлов, небезопасна от слова совсем. Понятное дело, что собрать готовый файл с плейлиста, можно одной командой из ffmpeg, но в той реализации которая вышла, достаточно просто открыть дев. тулзы и получить прямую ссылку на файл который можно сохранить себе на пк.

Помогите на будущее делать хорошо 🙂

  • Вопрос задан более трёх лет назад
  • 2152 просмотра

Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEDIA_ERR_DECODE (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Failed to prepare video sample for decode (Only Chrome has this problem) #2265

kenchanmc opened this issue Oct 31, 2017 · 11 comments

MEDIA_ERR_DECODE (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Failed to prepare video sample for decode (Only Chrome has this problem) #2265

kenchanmc opened this issue Oct 31, 2017 · 11 comments

Comments

kenchanmc commented Oct 31, 2017 •

  • Dash.js version: 2.6.2
  • Browser name/version: Chrome 61 , Chrome 62
  • OS name/version: Mac / Windows

Just use the following codes to play the video, only chrome cannot play the video. Other browsers work very good.

 var url2 = "http://xxxxxxxx/yyyyyy.mpd"; var player2 = dashjs.MediaPlayer().create(); player2.getDebug().setLogToBrowserConsole(true); player2.initialize(document.querySelector("#videoPlayer2"), url2,true); 
Console output
Debug.js:127 [10] EME detected on this user agent! (ProtectionModel_21Jan2015) 04:33:16.813 Debug.js:127 [20] Playback Initialized 04:33:16.814 Debug.js:127 [21] [dash.js 2.6.2] MediaPlayer has been initialized 04:33:16.931 Debug.js:127 [138] Parsing complete: ( xml2json: 3.98ms, objectiron: 0.765ms, total: 0.00474s) 04:33:16.932 Debug.js:127 [139] BaseURI set by Location to: http://nttca-portal.pd.ntt.hk/cctv2/ntt5/ 04:33:16.935 Debug.js:127 [142] SegmentTimeline detected using calculated Live Edge Time 04:33:16.936 Debug.js:127 [143] Local time: Wed Nov 01 2017 04:33:16 GMT+0800 (HKT) 04:33:16.936 Debug.js:127 [143] Server time: Wed Nov 01 2017 04:33:15 GMT+0800 (HKT) 04:33:16.936 Debug.js:127 [143] Difference (ms): -1936 04:33:16.942 Debug.js:127 [149] MediaSource attached to element. Waiting on open. 04:33:16.942 Debug.js:127 [149] Manifest has been refreshed at Wed Nov 01 2017 04:33:16 GMT+0800 (HKT)[1509481996.932] 04:33:17.019 Debug.js:127 [226] MediaSource is open! 04:33:17.019 Debug.js:127 [226] Duration successfully set to: 9007199254740991 04:33:17.021 Debug.js:127 [228] Added 0 inline events 04:33:17.022 Debug.js:127 [229] video codec: video/mp4;codecs="avc1.4d0029" 04:33:17.038 Debug.js:127 [245] No audio data. 04:33:17.038 Debug.js:127 [245] No text data. 04:33:17.038 Debug.js:127 [245] No fragmentedText data. 04:33:17.038 Debug.js:127 [245] No embeddedText data. 04:33:17.038 Debug.js:127 [245] No muxed data. 04:33:17.040 Debug.js:127 [247] Getting the request for video time : 28566.678 04:33:17.041 Debug.js:127 [248] Index for video time 28566.678 is 1 04:33:17.042 Debug.js:127 [249] Schedule controller starting for video 04:33:17.042 Debug.js:127 [249] Start Event Controller 04:33:17.044 Debug.js:127 [251] Native video element event: play 04:33:17.044 Debug.js:127 [251] Refresh manifest in 7.98 seconds. 04:33:17.047 Debug.js:127 [254] ScheduleController - getNextFragment 04:33:17.047 Debug.js:127 [254] ScheduleController - switch track has been asked, get init request for video with representationid = p0va0br79507 04:33:17.082 Debug.js:127 [289] Init fragment finished loading saving to video's init cache 04:33:17.085 Debug.js:127 [292] Native video element event: loadedmetadata 04:33:17.088 Debug.js:127 [295] Top qualityvideo index has changed from undefined to 0 04:33:17.090 Debug.js:127 [297] AbrController (video) stay on 0/0 (buffer: 0) 04:33:17.090 Debug.js:127 [297] ScheduleController - getNextFragment 04:33:17.090 Debug.js:127 [297] Getting the request for video time : 28551.001 04:33:17.090 Debug.js:127 [297] Index for video time 28551.001 is 1 04:33:17.090 Debug.js:127 [297] SegmentTimeline: 28551.001 / Infinity 04:33:17.091 Debug.js:127 [298] ScheduleController - getNextFragment - request is http://nttca-portal.pd.ntt.hk/cctv2/ntt5/chunk_ctvideo_cfm4s_ridp0va0br79507_cs2569590090_w1574825062_mpd.m4s 04:33:17.143 Debug.js:127 [350] Video Element Error: MEDIA_ERR_DECODE (CHUNK_DEMUXER_ERROR_APPEND_FAILED: Failed to prepare video sample for decode) 04:33:17.143 Debug.js:127 [350] [object MediaError] 04:33:17.144 Debug.js:127 [351] Schedule controller stopping for video 04:33:17.145 Debug.js:127 [352] Caught pending play exception - continuing (AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22) 

The text was updated successfully, but these errors were encountered:

epiclabsDASH added the More Information Required label Nov 1, 2017
kenchanmc commented Nov 1, 2017

Hi @epiclabsDASH ,I just shared the manifest to you by sending email to dashjs@epiclabs.io .Thanks so much ~

Hi @KhodyrevDS , do you reply to a wrong thread .

Contributor
epiclabsDASH commented Nov 1, 2017

@KhodyrevDS, please, let’s follow your case in the issue you opened (#2259). Thanks.

Contributor
epiclabsDASH commented Nov 1, 2017

Running dash conformance tool against your stream I get many warnings/errors:

### The brand 'isom' can only be a compatible, not major, brand ImageDescription name must be '' Warning: Validate_AVCConfig: Main profile signalled but constraint_set1_flag not set Warning: Validate_NAL_Unit (SPS): Main profile signalled but constraint_set1_flag not set Warning: Validate_NAL_Unit: more than 8 (15) trailing bits Validate_IODS: ISMA expects no-capability(0xFF) or Simple@L0-3 (0x08,01-03) or AdvSimple@L0-3b (0xF0-3,0xF7), or AVC (0x7f) for visualProfileLevelIndication ### error: moov-1:iods-1 ### Validate_IODS: visualProfileLevelIndication ( IOD: 254 (0xfe) ) signalled .. but there seems to be no video track ### error: moov-1:iods-1 ### ValidateIODSAtom: must have at least one Class_ES_ID_IncTag ### error: styp-3 ### styp not at the begining of a segment (abs. file offset 199742), this is unexpected ### error: moof-1:traf-1:tfhd-1 ### default-base-is-moof is not set, violating Section 6.3.4.2. of ISO/IEC 23009-1:2012(E): . the flag 'default-base-is-moof' shall be set ### error: moof-2 ### sequence_number 2155 in violation of: the value in a given movie fragment be greater than in any preceding movie fragment ### error: moof-2:traf-1:tfhd-1 ### default-base-is-moof is not set, violating Section 6.3.4.2. of ISO/IEC 23009-1:2012(E): . the flag 'default-base-is-moof' shall be set ### error: moof-3 ### sequence_number 2155 in violation of: the value in a given movie fragment be greater than in any preceding movie fragment ### error: moof-3:traf-1:tfhd-1 ### default-base-is-moof is not set, violating Section 6.3.4.2. of ISO/IEC 23009-1:2012(E): . the flag 'default-base-is-moof' shall be set tfdt base media decode time 21540.774000 not equal to accumulated decode time 0.000000 for track 1 for the first fragment of the movie. This software does not handle incomplete presentations. Applying correction. ### error: ### tfdt base media decode time 21540.774000 not equal to accumulated decode time 21552.147000 for track 1 for sequence_number 2155 (fragment absolute count 2) ### error: ### tfdt base media decode time 21540.774000 not equal to accumulated decode time 21563.520000 for track 1 for sequence_number 2155 (fragment absolute count 3) ### error: ### Referenced moof earliest_presentation_time 21552.147000 does not match to reference EPT 21540.774000 for sidx number 2 at reference count 0 ### error: ### starts_with_SAP declared but the first sample's composition time does not match, for sidx number 2 at reference count 0 (checking sample 1 of trun 1, traf 1, moof 2) ### error: ### SAP not found at the expected presentation time for sidx number 2 at reference count 0 ### error: ### Referenced moof earliest_presentation_time 21563.520000 does not match to reference EPT 21540.774000 for sidx number 3 at reference count 0 ### error: ### starts_with_SAP declared but the first sample's composition time does not match, for sidx number 3 at reference count 0 (checking sample 1 of trun 1, traf 1, moof 3) ### error: ### SAP not found at the expected presentation time for sidx number 3 at reference count 0 

For some reason, still not sure about which one (Chrome is not very verbose when reporting the issue. ),there is a problem in the stream that is causing issues in Chrome although same stream works fine in other browsers. It is not something related with dash.js, same issue happens in any other javascript based player I tested, but it would be nice knowing more about what is failing.

Do you have any information about what was the procedure/tools used for encoding this stream?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *