-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timestamp overlay to hw accelerated transcoded stream #402
Comments
It's very complicated questing about mixing filters and hardware acceleration.
|
I see. Btw, since adding a timestamp seems like something one would do often with cameras, it may also be a cool (and somewhat complicated feature ) |
Many changes with picture can't be done hardware. They are always software. So you need to mix hardware and software frames. It'll cost many CPU time. In your case you have raw frames on the input. So you can add timestamp with software and then pack it with hardware. But you need to learn FFmpeg docs. It's outside this project. Other users should unpack frames with hardware, make changes with software, and pack them again with hardware. |
Makes sense. It looks like my approach with a raw "exec:ffmpeg" was correct then |
I had the same issue, it can be done a bit more elegantly by using But again we needs to pass most ffmpeg params. Maybe a solution would be to add a streams:
camera1:
# We remove #hardware to avoid messing with -vf and set all params in #input and #video
- ffmpeg:<url>#input=vaapi_input#video=vaapi_h264_ts
ffmpeg:
# This is the 'http' template, with the addition of hwaccel (since we removed #hardware)
vaapi_input: >-
-hwaccel vaapi -hwaccel_output_format nv12 -fflags nobuffer -flags low_delay -i {input}
# The first line is just the 'h264/vaapi' template.
# The second is the drawtext filter, with the vaapi additions (format/hwupload)
vaapi_h264_ts: >-
-c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0
-vf "drawtext=text='%{localtime\: %Y-%m-%d %H\\\:%M\\\:%S}':x=2:y=2:fontsize=12:fontcolor=white:box=1:boxcolor=black:boxborderw=2,format=vaapi|nv12,hwupload" |
Timestamp template supported https://github.com/AlexxIT/go2rtc/releases/tag/v1.6.0 |
I am having trouble including the audio in the rtsp output. Could you help me out? Here is the corresponding part in my go2rtc.yaml:
The stream doorbell_raw above is the video feed extracted from The stream video_doorbell restream the doorbell_raw above with timestamp added but it does not carry audio. How could I fix it? Many Thanks! |
I have found out the issue. Due to the fact the arguments are passed from frigate to go2rtc, I have to add a separated audio option to the stream argument instead of putting it into the video argument. 😳
|
After a lot of trial and error, I was able to stream my webcam in h264 with hw acceleration and a text overlay:
Note: the double curly braces in {{output}} and {{localtime...}} are because I'm configuring inside frigate, and their formatter tries to fill "output" and crashes. That took me a lot to figure out too
Is there a standard way of doing this?
I was hoping for something like this:
or
ffmpeg:device?video=1#video=h264#raw=timestamp_hw#hardware
But I get no timestamp overlay.
The text was updated successfully, but these errors were encountered: