[FFmpeg-user] The option of -hwaccel device doesn't works well(FFmpeg n3.4)

Baek Seung Hoon seung51hoon at gmail.com
Sun Nov 5 07:39:05 EET 2017


Hello,

I will share you ffmpeg tests.
Please refer the following results.

*1. Use Sw-decder, Hw-Encoder with gpu 0*
 > ffmpeg -y -i ./input.mp4 -c:v h264_nvenc -gpu 0 -c:a copy ./output.mp4
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU
Memory |
|  GPU       PID   Type   Process name                             Usage
  |
|=============================================================================|
|    0     69091      C   ffmpeg
 167MiB |
+-----------------------------------------------------------------------------+

*2. Use Sw-decoder, Hw-Encoder with gpu 1*
 > ffmpeg -y -i ./input.mp4 -c:v h264_nvenc -gpu 1 -c:a copy ./output.mp4
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU
Memory |
|  GPU       PID   Type   Process name                             Usage
  |
|=============================================================================|
|    1     68417      C   ffmpeg
 167MiB |
+-----------------------------------------------------------------------------+

*3. Use Sw-decoder, Hw-Encoder with gpu 0 and scale_npp*
 > ffmpeg -y -i ./input.mp4 -filter_complex
"[0:v]hwupload_cuda,scale_npp=w=960:h=540[map0]" -map "[map0]" -c:v
h264_nvenc -gpu 0 -c:a copy ./output.mp4
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU
Memory |
|  GPU       PID   Type   Process name                             Usage
  |
|=============================================================================|
|    0     72208      C   ffmpeg
 147MiB |
+-----------------------------------------------------------------------------+

*4. Use Sw-decoder, Hw-Encoder with gpu 1 and scale_npp*
 > ffmpeg -y -i ./input.mp4 -filter_complex
"[0:v]hwupload_cuda,scale_npp=w=960:h=540[map0]" -map "[map0]" -c:v
h264_nvenc -gpu 1 -c:a copy ./output.mp4
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU
Memory |
|  GPU       PID   Type   Process name                             Usage
  |
|=============================================================================|
|    0     71589      C   ffmpeg
 147MiB |
+-----------------------------------------------------------------------------+

Please look the number 4 result.
Process GPU is only 0 even if Hw-encoder have gpu 1 option.
I wonder if Gpu devices can not be selected if hwupload_cuda filter is
present.

Thanks
BRs,

2017-11-05 3:50 GMT+09:00 James Girotti <james.girotti at gmail.com>:

> On Fri, Nov 3, 2017 at 7:48 PM, Baek Seung Hoon <seung51hoon at gmail.com>
> wrote:
>
> > Hello,
> > Thanks to your reply :-)
> >
> > As your mentions, Hw decoder already has resize option.
> > Why I use scale_npp filter with Sw decoder is Hw decoder(=cuvid) couldn't
> > read some of video files while Sw decoder(=h264) could read it.
> > So I choose a decoder this way -> use the Sw decoder if Hw decoder failed
> > read video file.
> >
>
> Like I mentioned; not really a problem to use sw-decoder. You should use
> whatever you want/need.
>
>
> > Your reply message is helpful to me ^^.
> > But I have a problem what same as previous mail.
> > In case that I use both Sw decoder and Hw encoder with below command, and
> > Only GPU0 encoder have working.
> > I did change option as -gpu 0 or -gpu 1, it doesn't affect.
> >
>
> Have you tried using sw-decoder->hw-decoder without scale-npp? Something
> like:
>
> ffmpeg -i ./input.mp4 -c:v h264_nvenc -gpu 1 -c:a copy ./output.mp4
>
> Does that use the correct GPU?
>
> I assume that "hwupload_cuda" have a unknown bug because "gpu" option was
> > works well when I remove "hwupload_cuda".
> >
>
> I think it's uploading to GPU 0 by default. There is an option 'device' for
> hwupload_cuda. Could you try specifying the device for hwupload_cuda?
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list