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 <dmng...@gmail.com> wrote: > On Sat, 9 Jul 2022 at 12:45, DEF <shaker....@gmail.com> wrote: > > > On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfart...@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-nvidia-gpu/ > > > > 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-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".