AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
6.71k stars 484 forks source link

Denoising camera stream with video filter in ffmpeg source #196

Closed felipecrs closed 1 year ago

felipecrs commented 1 year ago

Hi,

I'm looking for some help. The documentation says that #raw= can be used and there is even an example for -vf, a filter.

I'm trying to set ffmpeg:<rtsp-url>#raw=-vf hqdn3d#video=h264 to denoise some CFTV cameras I have, but it fails with:

image

If I try with ffmpeg:<rtsp-url>#raw=-vf hqdn3d#video=copy, it fails with:

2023-01-23 22:39:04.913598584  Filtergraph 'hqdn3d' was defined for video output stream 0:0 but codec copy was selected.
2023-01-23 22:39:04.913604503  Filtering and streamcopy cannot be used together.

If I try with ffmpeg:<rtsp-url>#raw=-vf hqdn3d only:

Output file #0 does not contain any stream

Or, with ffmpeg:<rtsp-url>#raw=-vf hqdn3d#video=:

2023-01-23 22:45:12.442259468  22:45:12.441 DBG [webrtc] add consumer error="codecs not match: MP4V-ES"
2023-01-23 22:45:12.442264863  22:45:12.442 DBG [mp4] add consumer error="codecs not match: MP4V-ES"
felipecrs commented 1 year ago

Here are the input RTSP URL codecs information:

image

AlexxIT commented 1 year ago

Filtering and streamcopy cannot be used together.

You can't change stream without transcoding. Thats why rotation or resize also needs #video=h264.

felipecrs commented 1 year ago

I see. Do you have any idea why it fails with the below?

image

AlexxIT commented 1 year ago

Corrupted H264 codec. Or not respect specs.

felipecrs commented 1 year ago

Apparently it was only missing hardware acceleration. I added #hardware=vaapi and it worked just fine!

Out of curiosity, the filter didn't do anything useful (I could not see any difference). 😅