Re: [FFmpeg-user] hwaccel cuvid with filters

2018-04-19 Thread Daniel Oberhoff


>> 
>> Maybe someone can explain how to use in filters?
> 
> 
> add 'hwdownload,format=nv12' to the beginning of filter.txt and
> 'hwupload_cuda' to the end.

I guess this could be improved with cuda specific filters. I am wondering if it 
was considered to allow generic gpu filters such as using OpenGL? That way it 
could also be made to work with non nvidia gpus
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] hwaccel cuvid with filters

2018-04-19 Thread James Girotti
>
> Maybe someone can explain how to use in filters?


This seems to be a gap in documentation, because it comes up every now and
then on the mailing list. I'll try to be brief. When using "-hwaccel cuvid"
the hw-decoded frames stay in GPU memory and are passed onto the
hw-encoder. The filters that you are trying to use are software filters.
They require decoded frames to be in CPU memory (and a format that is
compatible). To remedy this, you have two choices:

remove "-hwaccel cuvid" from your commandline (removing it causes decoded
frames to be copied from GPU->CPU memory and then CPU->GPU for encoding) OR

add 'hwdownload,format=nv12' to the beginning of filter.txt and
'hwupload_cuda' to the end.

The first option definitely reduces performance. I have not specifically
benchmarked the second, but it likely has the similar performance. The
filters you are applying will likely cause more reduction than either
though so it's moot.

Hope that helps.

-James
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] hwaccel cuvid with filters

2018-04-19 Thread Guido Holz
Hi all,

have a question of how to use in a correct way the hwaccel of nvidia. I get
the error "cuda is not supported as input pixel format". I didn't find help
how to use hwaccel with filters.
Maybe someone can explain how to use in filters?

Many thanks!

the following works:
ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -i Input.ts -t 3 -c:v h264_nvenc
-profile:v main -level 3.1 -crf 22  output.mp4


doesn't work:
ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -i Input.ts -t 3
-filter_complex_script filter.txt  c:v h264_nvenc -profile:v main -level
3.1 -crf 22  output.mp4

filter.txt:
color=black:960x540[c];
[c]drawtext=fontfile=CUTE.ttf:
  fontsize=50:
  text='NAME':
  fontcolor=white:
  x=80:
  y=400,
drawtext=fontfile=CUTE.ttf:
  fontsize=50:
  text='GO':
  fontcolor=white:
  x=120:
  y=330,
split[text][alpha];
[text][alpha]alphamerge[txta];
[txta]perspective=
 x0=256:
  y0=306:
  x1=575:
  y1=306:
  x2=0:
  y2=H:
  x3=W:
  y3=H:
  sense=1[persp];
[persp][0]blend=
  all_mode='softlight'


And the error is on bottom:

ffmpeg version 3.2.4-tessus Copyright (c) 2000-2017 the FFmpeg developers

  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609

  configuration: --prefix=/usr/local/ --extra-version=tessus
--enable-avisynth --enable-fontconfig --enable-gpl --enable-libass
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopus --enable-libschroedinger --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxvid
--enable-version3 --disable-ffplay --disable-indev=qtkit
--disable-indev=x11grab_xcb --enable-cuda --enable-cuvid --enable-nvenc
--enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include
--extra-ldflags=-L/usr/local/cuda/lib64

  libavutil  55. 34.101 / 55. 34.101

  libavcodec 57. 64.101 / 57. 64.101

  libavformat57. 56.101 / 57. 56.101

  libavdevice57.  1.100 / 57.  1.100

  libavfilter 6. 65.100 /  6. 65.100

  libswscale  4.  2.100 /  4.  2.100

  libswresample   2.  3.100 /  2.  3.100

  libpostproc54.  1.100 / 54.  1.100

Input #0, mpegts, from 'DEFAULT/PREROLL.ts':

  Duration: 00:00:03.00, start: 1.48, bitrate: 1728 kb/s

  Program 1

Metadata:

  service_name: Service01

  service_provider: FFmpeg

Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn,
50 tbc

Codec AVOption crf (Select the quality for constant quality mode) specified
for output file #0 (PREROLL_TMP/GUIDO.ts) has not been used for any stream.
The most likely reason is either wrong type (e.g. a video option with no
video streams) or that it is a private option of some encoder which was not
actually used for any stream.

Output #0, mpegts, to 'PREROLL_TMP/GUIDO.ts':

  Metadata:

encoder : Lavf57.56.101

Stream #0:0: Video: h264 (h264_nvenc) (Main), yuv420p, 960x540 [SAR 1:1
DAR 16:9], q=-1--1, 2000 kb/s, 25 fps, 90k tbn, 25 tbc

Metadata:

  encoder : Lavc57.64.101 h264_nvenc

Side data:

  cpb: bitrate max/min/avg: 0/0/200 buffer size: 400 vbv_delay:
-1

Stream mapping:

  Stream #0:0 (h264_cuvid) -> blend:bottom

  blend -> Stream #0:0 (h264_nvenc)

Press [q] to stop, [?] for help

[graph 0 input from stream 0:0 @ 0x31e7b20] Changing frame properties on
the fly is not supported by all filters.

[swscaler @ 0x3220cc0] cuda is not supported as input pixel format

Failed to inject frame into filter network: Invalid argument

Conversion failed!
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".