Closed dista closed 6 years ago
I have never managed to get this to work. Broadway's decoder wants complete NALUs. mp4 files have one or more complete NALUs in each mdat box. Each NALU is preceded by a four-byte length integer. It's necessary to get rid of those length integers before handing the NALUs to Broadway. webm boxing (generated by browser media capture) is a little more friendly, because the NALUs are in byte stream form with escape data.
yeah only complete nals make sense for the c-based decoder. just collect the data in a buffer if you dont send complete nals
for example: if I have a H264 NAL whose length is 20000, does the following will work?
In my test, it seems do not work, I have a backend which read one raw h264 file(use ffmpeg generated
ffmpeg -i "http://10.33.0.68/channels/preview/1/flv:500k" -an -vcodec libx264 -pass 1 -coder 0 -bf 0 -flags -loop -wpredp 0 -vb 500k /tmp/p.h264
), I read it every 50 ms and 10240 bytes for each, then send it to browser using websockets.But the result is it can decode some frame, but stuck after that.
thanks.