Error: Impossible to convert between the formats...(Nvidia codecs)
Hello, I try to use Nvidia codecs in live transcoding. The input stream is from an IP camera (Hikvision) and its color format is "*yuvj420p*". My command is: ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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" but I am faced with this error: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed! if I remove "-hwaccel_output_format cuda", the transcoding starts, but the decoded stream is sent to system memory. I prefer to keep it in GPU memory to decrease the latency. What should I do to fix this? I would appreciate any help. Regards, Ben.
On Sat, 9 Jul 2022 at 10:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is from an IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
but I am faced with this error: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed!
if I remove "-hwaccel_output_format cuda", the transcoding starts, but the decoded stream is sent to system memory. I prefer to keep it in GPU memory to decrease the latency. What should I do to fix this? I would appreciate any help.
Regards, Ben.
Remove -s 1920x1080 and test
Thanks for the recommendation. I removed it, but the same error exists. The input stream size is 1920x1080 Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed! On Sat, Jul 9, 2022 at 3:30 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 10:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is from an IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
but I am faced with this error: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed!
if I remove "-hwaccel_output_format cuda", the transcoding starts, but the decoded stream is sent to system memory. I prefer to keep it in GPU memory to decrease the latency. What should I do to fix this? I would appreciate any help.
Regards, Ben.
Remove -s 1920x1080 and test
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is from an IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
Check out documenation at https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidi... Use -vsync 0 option with decode to prevent FFmpeg from creating output YUV with duplicate and extra frames. This seems to be the commonest runtime issue. Try ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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" Def
but I am faced with this error: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed!
if I remove "-hwaccel_output_format cuda", the transcoding starts, but the decoded stream is sent to system memory. I prefer to keep it in GPU memory to decrease the latency. What should I do to fix this? I would appreciate any help.
Regards, Ben.
On Sat, 9 Jul 2022 at 12:45, DEF <shaker.doc@gmail.com> wrote:
On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is from
an
IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
Check out documenation at
https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidi...
Use -vsync 0 option with decode to prevent FFmpeg from creating output YUV with duplicate and extra frames. This seems to be the commonest runtime issue.
Try ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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"
Def
The error may have to do with the specified pixel format filter in the command line, specifically " -pix_fmt yuv420p". Remove that and retest with a command such as this one: ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -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" With CUDA/NVDEC hwaccel, the default pixel format will be CUDA. Inserting a request for another format via "-pix_fmt yuv420p" as is would fail, as it introduces the need for hwdownload and format conversion which isn't automatic. Please retest and report back.
Thank you, Dennis. By removing _pix_fmt the issue was solved. But when I change the preset from p2 to p3 or p4, I face this error: [hevc @ 000001ebb41bdc40] hardware accelerator failed to decode picture [hevc @ 000001ebb41bb440] Could not find ref with POC 24 [rtsp @ 000001ebb42500c0] Invalid DTS: 126000 PTS: 118800 in output stream 0:0, replacing by guess Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ebb41bbc40] No decoder surfaces left [hevc @ 000001ebb41bbc40] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument Could you help me to fix this error please? On Sat, Jul 9, 2022 at 6:11 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 12:45, DEF <shaker.doc@gmail.com> wrote:
On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is
from an
IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
Check out documenation at
https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidi...
Use -vsync 0 option with decode to prevent FFmpeg from creating output YUV with duplicate and extra frames. This seems to be the commonest runtime issue.
Try ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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"
Def
The error may have to do with the specified pixel format filter in the command line, specifically " -pix_fmt yuv420p". Remove that and retest with a command such as this one:
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -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"
With CUDA/NVDEC hwaccel, the default pixel format will be CUDA. Inserting a request for another format via "-pix_fmt yuv420p" as is would fail, as it introduces the need for hwdownload and format conversion which isn't automatic. Please retest and report back. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sat, 9 Jul 2022 at 14:01, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. By removing _pix_fmt the issue was solved. But when I change the preset from p2 to p3 or p4, I face this error:
[hevc @ 000001ebb41bdc40] hardware accelerator failed to decode picture [hevc @ 000001ebb41bb440] Could not find ref with POC 24 [rtsp @ 000001ebb42500c0] Invalid DTS: 126000 PTS: 118800 in output stream 0:0, replacing by guess Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ebb41bbc40] No decoder surfaces left [hevc @ 000001ebb41bbc40] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument
Could you help me to fix this error please?
Sure, I can. By design, ffmpeg's NVDEC implementation is required to allocate surfaces to handle bitstreams with advanced features such as B-frames, interlaced content, etc. However, the pre-allocated surfaces may not be enough in some cases, and that can be fixed by setting the -extra_hw_frames {n} option, with n > 2. See this ticket for more details: https://trac.ffmpeg.org/ticket/7562 Try this out: ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 3 rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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" And report back.
Thanks, Dennis. I added it in -preset p4 and the same error appeared: hevc @ 000001ac32f034c0] hardware accelerator failed to decode picture Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ac41cd1180] Could not find ref with POC 5 [hevc @ 000001ac41d82640] No decoder surfaces left38 bitrate=N/A speed=2.09x [hevc @ 000001ac41d82640] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument On Sat, Jul 9, 2022 at 7:11 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 14:01, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. By removing _pix_fmt the issue was solved. But when I change the preset from p2 to p3 or p4, I face this error:
[hevc @ 000001ebb41bdc40] hardware accelerator failed to decode picture [hevc @ 000001ebb41bb440] Could not find ref with POC 24 [rtsp @ 000001ebb42500c0] Invalid DTS: 126000 PTS: 118800 in output stream 0:0, replacing by guess Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ebb41bbc40] No decoder surfaces left [hevc @ 000001ebb41bbc40] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument
Could you help me to fix this error please?
Sure, I can.
By design, ffmpeg's NVDEC implementation is required to allocate surfaces to handle bitstreams with advanced features such as B-frames, interlaced content, etc. However, the pre-allocated surfaces may not be enough in some cases, and that can be fixed by setting the -extra_hw_frames {n} option, with n > 2. See this ticket for more details: https://trac.ffmpeg.org/ticket/7562
Try this out:
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 3 rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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"
And report back. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sat, 9 Jul 2022 at 14:25, Ben Parham <behfarteam@gmail.com> wrote:
Thanks, Dennis. I added it in -preset p4 and the same error appeared:
hevc @ 000001ac32f034c0] hardware accelerator failed to decode picture Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ac41cd1180] Could not find ref with POC 5 [hevc @ 000001ac41d82640] No decoder surfaces left38 bitrate=N/A speed=2.09x [hevc @ 000001ac41d82640] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument
How many encoder sessions are you running simultaneously? Try bumping up the number of extra_hw_frames, say 6 to 10, and retest.
Thank you, Dennis. It works with 6 in-preset p4. Now I am running one stream, but I will run 5 streams in RTX A2000. Does it support this number in all streams? On Sat, Jul 9, 2022 at 7:29 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 14:25, Ben Parham <behfarteam@gmail.com> wrote:
Thanks, Dennis. I added it in -preset p4 and the same error appeared:
hevc @ 000001ac32f034c0] hardware accelerator failed to decode picture Error while decoding stream #0:0: Generic error in an external library [hevc @ 000001ac41cd1180] Could not find ref with POC 5 [hevc @ 000001ac41d82640] No decoder surfaces left38 bitrate=N/A speed=2.09x [hevc @ 000001ac41d82640] decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params) failed -> CUDA_ERROR_INVALID_VALUE: invalid argument
How many encoder sessions are you running simultaneously? Try bumping up the number of extra_hw_frames, say 6 to 10, and retest. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sat, 9 Jul 2022 at 14:40, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. It works with 6 in-preset p4. Now I am running one stream, but I will run 5 streams in RTX A2000. Does it support this number in all streams?
Hello there, That GPU has no limitations on the simultaneous number of NVENC sessions it can handle. However, throughput will be significantly impacted by its' low power profile limit (70W?) as you add more transcode jobs. This is an issue I've observed in production with a similar GPU profile, the Tesla T4. You may consider tuning these encoder presets to compensate for throughput drops with multiple simultaneous transcode sessions, if real time encoding is a priority to you. And on NVDEC: VRAM usage can also be quite steep with multiple sessions. Monitor that carefully via nvidia-smi as you add more transcode jobs.
Hi again, Sure, I will do it based on that. Thank you for your help. If I face an issue I'll contact you again. I appreciate it. On Sat, Jul 9, 2022 at 7:55 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 14:40, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. It works with 6 in-preset p4. Now I am running one stream, but I will run 5 streams in RTX A2000. Does it support this number in all streams?
Hello there, That GPU has no limitations on the simultaneous number of NVENC sessions it can handle. However, throughput will be significantly impacted by its' low power profile limit (70W?) as you add more transcode jobs. This is an issue I've observed in production with a similar GPU profile, the Tesla T4. You may consider tuning these encoder presets to compensate for throughput drops with multiple simultaneous transcode sessions, if real time encoding is a priority to you. And on NVDEC: VRAM usage can also be quite steep with multiple sessions. Monitor that carefully via nvidia-smi as you add more transcode jobs. _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sat, 9 Jul 2022, 15:05 Ben Parham, <behfarteam@gmail.com> wrote:
Hi again, Sure, I will do it based on that. Thank you for your help. If I face an issue I'll contact you again. I appreciate it.
On Sat, Jul 9, 2022 at 7:55 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 14:40, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. It works with 6 in-preset p4. Now I am running one stream, but I will run 5 streams in RTX A2000. Does it support this number in all streams?
Hello there, That GPU has no limitations on the simultaneous number of NVENC sessions it can handle. However, throughput will be significantly impacted by its' low power profile limit (70W?) as you add more transcode jobs. This is an issue I've observed in production with a similar GPU profile, the Tesla T4. You may consider tuning these encoder presets to compensate for throughput drops with multiple simultaneous transcode sessions, if real time encoding is a priority to you. And on NVDEC: VRAM usage can also be quite steep with multiple sessions. Monitor that carefully via nvidia-smi as you add more transcode jobs.
Sure thing, no worries.
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. On Sat, Jul 9, 2022 at 9:52 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022, 15:05 Ben Parham, <behfarteam@gmail.com> wrote:
Hi again, Sure, I will do it based on that. Thank you for your help. If I face an issue I'll contact you again. I appreciate it.
On Sat, Jul 9, 2022 at 7:55 PM Dennis Mungai <dmngaie@gmail.com> wrote:
On Sat, 9 Jul 2022 at 14:40, Ben Parham <behfarteam@gmail.com> wrote:
Thank you, Dennis. It works with 6 in-preset p4. Now I am running one stream, but I will run 5 streams in RTX A2000. Does it support this number in all streams?
Hello there, That GPU has no limitations on the simultaneous number of NVENC sessions it can handle. However, throughput will be significantly impacted by its' low power profile limit (70W?) as you add more transcode jobs. This is an issue I've observed in production with a similar GPU profile, the Tesla T4. You may consider tuning these encoder presets to compensate for throughput drops with multiple simultaneous transcode sessions, if real time encoding is a priority to you. And on NVDEC: VRAM usage can also be quite steep with multiple sessions. Monitor that carefully via nvidia-smi as you add more transcode jobs.
Sure thing, no worries.
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Sun, 10 Jul 2022 at 10:28, Ben Parham <behfarteam@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.
On Mon, 27 Feb 2023 at 03:48, Dennis Mungai <dmngaie@gmail.com> wrote:
On Sun, 10 Jul 2022 at 10:28, Ben Parham <behfarteam@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.
Thank you DEF. The problem was solved by removing pix_fmt based on Dennis's recommendation. On Sat, Jul 9, 2022 at 5:45 PM DEF <shaker.doc@gmail.com> wrote:
On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfarteam@gmail.com> wrote:
Hello,
I try to use Nvidia codecs in live transcoding. The input stream is from
an
IP camera (Hikvision) and its color format is "*yuvj420p*". My command is:
ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -s 1920x1080 -preset p2 -pix_fmt yuv420p -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"
Check out documenation at
https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidi...
Use -vsync 0 option with decode to prevent FFmpeg from creating output YUV with duplicate and extra frames. This seems to be the commonest runtime issue.
Try ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2 -pix_fmt yuv420p -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"
Def
but I am faced with this error: Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 Conversion failed!
if I remove "-hwaccel_output_format cuda", the transcoding starts, but
the
decoded stream is sent to system memory. I prefer to keep it in GPU memory to decrease the latency. What should I do to fix this? I would appreciate any help.
Regards, Ben.
ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (3)
-
Ben Parham -
DEF -
Dennis Mungai