samirkumardas / jmuxer

jMuxer - a simple javascript mp4 muxer that works in both browser and node environment.
Other
549 stars 108 forks source link

No. of frames of the last chunk: 0 #65

Closed MistaHanyi closed 3 years ago

MistaHanyi commented 3 years ago

Sorry to bother you about this. I'm totally new to this video thing.

I got raw h.264 data from camera, and my code is like this:

soc.on('androidOnline', function (value) {
        console.log('androidOnline: ', value)
        if (value) {
            deviceOnline = true

            /**
             * start play live
             */
            soc.on('videoStream', buffer => {
                const uint8Arr = new Uint8Array(buffer)
                console.log(unit8Arr)
                const jmuxer = new JMuxer({
                    node: 'jmplayer',
                    mode: 'video',
                    flushingTime: 1000,
                    fps: 25,
                    debug: true,
                })

                jmuxer.feed({
                    video: uint8Arr
                })
            })

        }
    })

The brower console keeps throw tips " jmuxer.min.js:1 jmuxer: No. of frames of the last chunk: 0" and errors.

The picture is here:

console_20201207165124

It will helps me a lot if you point some directions that where wents wrong and what kind of background knowledges I should look up to solve this problem. Much thanks.

samirkumardas commented 3 years ago

First, move the instantiation of jmuxer outside of the videoStream callback. It is creating a new instance every time.

chendishen commented 3 years ago

@samirkumardas Hello, excuse me, I recently used it to receive H264 video stream from websocket in the project of electron + react, but there will be no. of frames of the last chunk: 0 as mentioned above. I think it is because of the virtual dom of react that the update of video source is not successful, or is my use method wrong?

chendishen commented 3 years ago

image

MistaHanyi commented 3 years ago

First, move the instantiation of jmuxer outside of the videoStream callback. It is creating a new instance every time.

Thanks. What a fool of me not noticing that.

MistaHanyi commented 3 years ago

@samirkumardas I'm done. You can close the issus whenever you want. But there is another user posted some questions. Leave it to you. Anyway, thanks a lot.

samirkumardas commented 3 years ago

@chendishen it is not related to virtual dom. It seems you are feeding a tiny chunk of data at a time that contains no picture frame sometimes.

  1. Does it render anything on the player?
  2. The flashing time is 10ms. It is not getting enough data to be flashed actually. Try with a larger value first like 500 or 1000 to see if it plays properly.
  3. Make sure your data is valid. Capture some data and write it into a file. Then play it with this player or VLC player
chendishen commented 3 years ago

@samirkumardas Thanks. It's not really a virtual DOM problem.. This is because my video tag doesn't add muted autoplay = autoplay. After adding it, I can use it...

zhangpeibisha commented 2 years ago

@samirkumardas谢谢。这不是真正的虚拟 DOM 问题。这是因为我的视频标签没有添加静音自动播放 = 自动播放。添加后,我可以使用它...

Hello, what properties should be configured in the video tag ~ I also encountered the same problem as you ~