[FFmpeg-user] Error: Impossible to convert between the formats...(Nvidia codecs)
Dennis Mungai
dmngaie at gmail.com
Mon Feb 27 02:51:43 EET 2023
On Mon, 27 Feb 2023 at 03:48, Dennis Mungai <dmngaie at gmail.com> wrote:
> On Sun, 10 Jul 2022 at 10:28, Ben Parham <behfarteam at gmail.com> wrote:
>
>> Hi Dennis,
>> Now I am streaming with two cameras but I have a small problem, the audio
>> stream is not synced with the video stream, and there is a small delay of
>> around 0.2 seconds.
>> How can I fix it? I would appreciate your help.
>> Regards,
>> Ben.
>>
>
> This somehow slipped through my email filters, seeing this now.
>
> Try this variant and report back:
>
> ffmpeg -y -fps_mode passthrough -hwaccel cuda -hwaccel_output_format cuda
> -extra_hw_frames 3
> rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags
> +genpts -vf scale_cuda=1920:1080 -vcodec hevc_nvenc -delay 0 -preset p2
> -bf:v 0 -tune hq -rc vbr -vb 700k -maxrate 800k -minrate
> 200k -bufsize 800k -g 25 -acodec copy -strict -2 -flags +global_header
> -f rtsp "rtsp://localhost:8000/stream"
>
> See the changes I made:
>
> 1. Completely disabled B-frames. B-frames add to encoder latency.
> 2. See the new option -fps_mode, which replaces the now-deprecated -vsync
> parameter.
> 3. I also removed the +low_delay flag, as its' known to be very broken on
> any input with B-frames.
> 4. To nvenc, I added the -delay parameter, set to 0.
>
> The latency is propagated by the “delay” parameter (internally referred to
> as async_depth) passed to FFmpeg for nvenc. The code in FFmpeg’s nvenc.c waits
> until this number of extra frames have been buffered
> <https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvenc.c#L981>
> before emitting any frames and is intended to support parallel and 1:N
> encoding scenarios.
>
> The assigned default value is INT_MAX which later gets reduced down to the
> number of NVENC surfaces initialized minus one, which itself has an initial
> value of 4 when unset/by default.
>
> This can be overriden by setting -delay:v 0 to fix the output latency.
>
>
> Retest and report back.
>
>
>
You can also add
-max_interleave_delta 0
To the output options, like this to the command line above:
ffmpeg -y -fps_mode passthrough -hwaccel cuda -hwaccel_output_format cuda
-extra_hw_frames 3
rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags
+genpts -vf scale_cuda=1920:1080 -vcodec hevc_nvenc -delay 0 -preset p2
-bf:v 0 -tune hq -rc vbr -vb 700k -maxrate 800k -minrate
200k -bufsize 800k -g 25 -acodec copy -strict -2 -flags +global_header
-max_interleave_delta 0 -f rtsp "rtsp://localhost:8000/stream"
And report back on the results.
More information about the ffmpeg-user
mailing list