Opened 7 years ago

Last modified 7 years ago

#7119 new enhancement

Applying 3d LUT during h264 hardware encoding (lut3d filter + h264_vaapi)

Reported by: ethaniel Owned by:
Priority: wish Component: ffmpeg
Version: unspecified Keywords: lut3d h264_vaapi
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Is it somehow possible to apply a 3d LUT filter "on the fly" via hardware encoding?
I have a inbound stream which needs color correction (it's a webcam that broadcasting to youtube). I want to give it a more "cinematic" feel.

When I run this I get 8-9 fps tops:

ffmpeg \
  -vaapi_device /dev/dri/renderD128  -hwaccel vaapi -hwaccel_output_format VAProfileH264ConstrainedBaseline \
  -re -i http://192.168.0.147/0.flv \
  -acodec pcm_s16le -f s16le -i /dev/zero \
  -ac 1 -acodec aac -ar 44100 -ab 128k -strict experimental \
  -vf 'format=nv12,hwupload' \
  -threads 8 \
  -r 30 -g 60 \
  -c:v h264_vaapi -b:v 5M -minrate:v 5M -maxrate:v 5M \
  -f flv rtmp://a.rtmp.youtube.com/live2/KEY

If I remove "lut3d=3d.cube", then I get 30fps.

I assume that lut3d is performed by the cpu and not the gpu.

Is it possible to make it work via GPU to keep the 30fps?

(I'm willing to put a $200 bounty)

Change History (2)

comment:1 by ethaniel, 7 years ago

Sorry, I posted the wrong command in the ticket.

8-9 fps:

ffmpeg \
  -vaapi_device /dev/dri/renderD128  -hwaccel vaapi -hwaccel_output_format VAProfileH264ConstrainedBaseline \
  -re -i http://192.168.0.147/0.flv \
  -acodec pcm_s16le -f s16le -i /dev/zero \
  -ac 1 -acodec aac -ar 44100 -ab 128k -strict experimental \
  -vf 'lut3d=3d.cube,format=nv12,hwupload' \
  -threads 8 \
  -r 30 -g 60 \
  -c:v h264_vaapi -b:v 5M -minrate:v 5M -maxrate:v 5M \
  -f flv rtmp://a.rtmp.youtube.com/live2/KEY

30 fps:

ffmpeg \
  -vaapi_device /dev/dri/renderD128  -hwaccel vaapi -hwaccel_output_format VAProfileH264ConstrainedBaseline \
  -re -i http://192.168.0.147/0.flv \
  -acodec pcm_s16le -f s16le -i /dev/zero \
  -ac 1 -acodec aac -ar 44100 -ab 128k -strict experimental \
  -vf 'format=nv12,hwupload' \
  -threads 8 \
  -r 30 -g 60 \
  -c:v h264_vaapi -b:v 5M -minrate:v 5M -maxrate:v 5M \
  -f flv rtmp://a.rtmp.youtube.com/live2/KEY
Last edited 7 years ago by ethaniel (previous) (diff)

comment:2 by Hendrik, 7 years ago

Not unless someone writes a vaapi-compatible hardware LUT filter.

PS:
Your hwaccel_output_format setting seems weird, thats not to select an encoding profile.

Last edited 7 years ago by Hendrik (previous) (diff)
Note: See TracTickets for help on using tickets.