Problem when using scale_cuda filter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem when using scale_cuda filter

FFmpeg-users mailing list
Hello, I am trying to do full hardware video transcoding with scaling.

Here is my console command:
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "input.mp4" -vf
scale_cuda=-2:360 -c:v h264_nvenc -b:v 2000k "output.mp4"

Input stream info:
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 1711 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc
(default)
Output stream:
Stream #0:0(und): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661),
cuda, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 1 fps, 16384 tbn,
1 tbc (default)

Unfortunately, the output video is stretched vertically. It seems like
filter crops around 60px from the bottom of original video, then scales
1860x1080 to 640x360. Curious that the very first frame is scaled correctly.
Scale_npp function doesn't have this problem, but I would prefer use
scale_cuda.

Could you help me to make this filter work as expected?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem when using scale_cuda filter

Brainiarc7
On Thu, 21 Mar 2019 at 05:25, Александр via ffmpeg-user <
[hidden email]> wrote:

> Hello, I am trying to do full hardware video transcoding with scaling.
>
> Here is my console command:
> ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "input.mp4" -vf
> scale_cuda=-2:360 -c:v h264_nvenc -b:v 2000k "output.mp4"
>
> Input stream info:
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 1920x1080 [SAR 1:1 DAR 16:9], 1711 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc
> (default)
> Output stream:
> Stream #0:0(und): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661),
> cuda, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 1 fps, 16384 tbn,
> 1 tbc (default)
>
> Unfortunately, the output video is stretched vertically. It seems like
> filter crops around 60px from the bottom of original video, then scales
> 1860x1080 to 640x360. Curious that the very first frame is scaled
> correctly.
> Scale_npp function doesn't have this problem, but I would prefer use
> scale_cuda.
>
> Could you help me to make this filter work as expected?
>
>
Hello there,

Unfortunately, the scale_cuda parameters are quite limited, as you can
confirm:

ffmpeg -h filter=scale_cuda

Compared to scale_npp:

ffmpeg -h filter=scale_npp

Is there a specific reason as to why you'd prefer scale_cuda over
scale_npp?

I wouldn't want to make the assumption that scale_cuda is analogous to the
scale filter, wherein you'd be able to use specific flags that the latter
supports:

ffmpeg -h filter=scale

Considering that some of the options mapped to the scale filter are not
present in the scale_cuda filter in the documentation:
https://ffmpeg.org/ffmpeg-filters.html#scale-1

The scale_cuda filter was contributed by Yogender Gupta <[hidden email]>
so you may try contacting him for clarification on this.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem when using scale_cuda filter

FFmpeg-users mailing list
Thanks for the answer.

 > Is there a specific reason as to why you'd prefer scale_cuda over
 > scale_npp?

Indeed, scale_cuda accepts width and height options only. In my
situation I have a small project on Windows and as far as I know, there
is no way to compile static version of ffmpeg with libnpp support. That
is why scale_cuda is more convenient to me, because it doesn't require
CUDA SDK installed.

Even so, the problem remains and I would be very grateful if someone
more experienced than me would confirm this issue before reporting it.
This filter was added almost 2 years ago, I believe more in my
incompetence than in existence of such a critical and obvious bug which
corrupts the output.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem when using scale_cuda filter

Carl Eugen Hoyos-2
In reply to this post by FFmpeg-users mailing list
2019-03-21 3:25 GMT+01:00, Александр via ffmpeg-user <[hidden email]>:

> ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i "input.mp4"
> -vf scale_cuda=-2:360 -c:v h264_nvenc -b:v 2000k "output.mp4"

Did you test "-vf scale_cuda=640:360"?

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem when using scale_cuda filter

FFmpeg-users mailing list
> Did you test "-vf scale_cuda=640:360"?

Yes, excuse me, forgot to mention that in the first post.
Exact values don't work either, first frame is ok, others are resized.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".