Decode H264 frames #66
Replies: 8 comments 1 reply
-
Hello, i never tried to decode H264 (is it H264?) from RTSP in Go, but i think it can be done - i have to warn you, the procedure will require a lot of trial and error, and is the following:
actually, i don't know how to perform the 3rd point in Go. It probably requires interfacing with x264 or libav. a draft could be (see comment below) |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I am new in Go (but I have experience with Python and C/C++), so I will try to create an example based on your guidelines and if everything is fine, I will make a pull request. |
Beta Was this translation helpful? Give feedback.
-
@mihail-ivanov I did something similar with gocv-receive it takes the incoming RTP, packages it into a ivf file and then sends to ffmpeg using stdin/stdout! You could also send the RTP straight in (over the network) and then read from ffmpeg stdout into gocv. Something like rtp-forwarder |
Beta Was this translation helpful? Give feedback.
-
An example on how to obtain raw H264 frames from RTSP has been added here: https://github.com/aler9/gortsplib/blob/main/examples/client-read-h264/main.go But i can't go any further due to possible patent infringement. Anyway (for anyone interested) it's enough to find out how to use Gstreamer with Go to proceed and decode the frames. |
Beta Was this translation helpful? Give feedback.
-
Thank you, @aler9. I think that would help me a lot. |
Beta Was this translation helpful? Give feedback.
-
@aler9, I was check your example
nalus, _, err := dec.Decode(buf)
if err != nil {
fmt.Println(err)
return
} |
Beta Was this translation helpful? Give feedback.
-
@mderit replace |
Beta Was this translation helpful? Give feedback.
-
now there's a working example that shows how to decode raw frames with gortsplib: |
Beta Was this translation helpful? Give feedback.
-
Hi,
Is there some solution, which decodes the received frames and then use them in GoCV?
For example in client-read.go to decode the received buffer and load it in
img := gocv.NewMat()
:https://github.com/aler9/gortsplib/blob/2c7dbe200908f3484fd43ed937fd609d2b2b912e/examples/client-read.go#L24
Thanks,
Mihail
Beta Was this translation helpful? Give feedback.
All reactions