codewithpassion / foxglove-studio-h264-extension

POC extension to render h264
MIT License
9 stars 5 forks source link

How to prepare video? #8

Open argoroots opened 1 month ago

argoroots commented 1 month ago

Hi

Can You provide example how to convert video to correct format?

Right now I use those two commands to convert video from HEVC to NALUs:

ffmpeg -i hevc.mp4 -c:v libx264 -an -r 30 -g 1 output.mp4
ffmpeg -i output.mp4 -f image2 -vcodec copy -bsf h264_mp4toannexb nalus/'%d.h264'

Then I save those as foxglove_msgs/CompressedVideo messages and it works with Foxglove Image panel.

But I need to put it work with Your extension. Is it possible?

argoroots commented 1 month ago

If I put those NALUs to CompressedImage message I see no image in this Extension panel and I see lots of following errors in console:

h264-utils.ts:824 Uncaught Error: SPS error: invalid profile_idc
    at new SPS (h264-utils.ts:824:1)
    at RenderWorker.getDecoderConfig ([module]:128:25)
    at RenderWorker.onFrame ([module]:105:40)
    at eval ([module]:150:16)
2
VM116 preload.js:47 Uncaught Error: SPS error: invalid profile_idc
h264-utils.ts:824 Uncaught Error: SPS error: invalid profile_idc
    at new SPS (h264-utils.ts:824:1)
    at RenderWorker.getDecoderConfig ([module]:128:25)
    at RenderWorker.onFrame ([module]:105:40)
    at eval ([module]:150:16)
VM116 preload.js:47 Uncaught Error: NALU error: invalid NALU header
h264-utils.ts:814 Uncaught Error: NALU error: invalid NALU header
    at new SPS (h264-utils.ts:814:1)
    at RenderWorker.getDecoderConfig ([module]:128:25)
    at RenderWorker.onFrame ([module]:105:40)
    at eval ([module]:150:16)
h264-utils.ts:824 Uncaught Error: SPS error: invalid profile_idc
    at new SPS (h264-utils.ts:824:1)
    at RenderWorker.getDecoderConfig ([module]:128:25)
    at RenderWorker.onFrame ([module]:105:40)
    at eval ([module]:150:16)