ngraziano / SharpRTSP

A RTSP handling library
Other
519 stars 181 forks source link

Simple H264 Encoder doesn't work with hardware decoders? #76

Open kristen-movares opened 2 years ago

kristen-movares commented 2 years ago

Running the Simple h264 Encoder with RTSPServer and into VLC, when VLC has hardware decoding enabled it just shows a black screen but when disabling hardware decoding the stream is shown just fine.

Is it even possible to support hardware decoding or does that then require compressing the frames?

We're using the Simple H264 encoder to render a placeholder nal packet when streams aren't live. It would be nice if the whole encoding proces wasn't needed and we could just resend the previously encoded nal packet. Suggestions or ideas are welcome, i'm kinda clueless when it comes to NAL stuff.

RogerHardiman commented 2 years ago

Had never thought of using the simple encoder as a placeholder NAL. On my projects I capture the NALs for my placeholders and save the in a file and use that.

You can do that easily. Suppose you have a JPEG You can do something like ffmpeg -i picture.jpeg outputfile.264

This will give you a H264 file representing your one JPEG. I then play that file out as my placeholder NAL.

Your .264 file will end up with headers starting either 00 00 01 or starting 00 00 00 01 for each part of the video, first the SPS data block, then the PPS data block and then one or more NALs that make the image.

kristen-movares commented 2 years ago

Don't the Nal packets contain timing info? replaying the same packet seems to cause issues for us? currently we reencode the same frame constantly, which i think isn't needed.