Opened 6 days ago

Closed 4 days ago

#11256 closed task (completed (art))

How to use "curves" filter with "hwupload" in FFmpeg?

Reported by: elias tsolis Owned by:
Priority: normal Component: avfilter
Version: 7.0 Keywords: curves
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by elias tsolis)

currently, i use this, however, i am unable to run it specifying points in curves. Is any option to use a gnuplot file directly? or to extract smplayer options on brightness, gamma etc. to use them with ffmpeg somehow?

for vids in *.avi; do ffmpeg -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i "$vids" -vf 'curves=preset=lighter,setpts=2*PTS,format=nv12,hwupload,scale_vaapi=w=2560:h=1440:format=nv12' -strict experimental -c:v hevc_vaapi -b:v 20M -video_track_timescale 90000 "a_${vids/.*}.mp4"; done;

debian trixie linux,
ffmpeg version 7.0.2-3

Change History (9)

comment:1 by elias tsolis, 6 days ago

Version: unspecified7.0

comment:2 by elias tsolis, 6 days ago

Description: modified (diff)

comment:3 by MasterQuestionable, 5 days ago

Cc: MasterQuestionable added
Component: undeterminedavfilter
Keywords: curves added
Summary: how i can use curves options in hwupload in ffmpeg ?How to use "curves" filter with "hwupload" in FFmpeg?
Type: defecttask

͏    Interpreted filter-chain:
͏    curves=preset=lighter,
͏    setpts=2*PTS,
͏    format=nv12,
͏    hwupload,
͏    scale_vaapi=w=2560:h=1440:format=nv12

͏    Refer:
͏    https://ffmpeg.org/ffmpeg-filters.html#curves
͏    etc.

comment:4 by elias tsolis, 5 days ago

i have read, and tried different combinations, nothing worked.
this does not work -->
curves=blue='0/0 0.5/0.58 1/1'
or curves=all='0/0,0.5/0.58,1/1'
or curves=all='0/0:0.5/0.58:1/1'
inside this command:

for vids in *.avi; do ffmpeg -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i "$vids" -vf 'curves=all='0/0 0.5/0.58 1/1',setpts=2*PTS, format=nv12,hwupload,scale_vaapi=w=2560:h=1440:format=nv12' -strict experimental -c:v hevc_vaapi -b:v 20M -video_track_timescale 90000 "a_${vids/.*}.mp4"; done;

Last edited 5 days ago by elias tsolis (previous) (diff)

comment:5 by MasterQuestionable, 5 days ago

͏    Your Unix Shell syntax is invalid: bad quoting.
͏    To embed literal `'` within such quoting: use `'\''`.
͏    E.g. "a'b", as 'a'\''b'.

͏    You may also look at:
͏    https://www.shellcheck.net/
͏    https://www.gnu.org/software/bash/manual/bash.html#Quoting
͏    https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html
͏    https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xcu_chap01.html#tag_23_02_02
͏    ; for reference.

Last edited 5 days ago by MasterQuestionable (previous) (diff)

comment:6 by elias tsolis, 5 days ago

dont work

ffmpeg  -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i b.mp4 -vf 'curves=all='\"0/0 0.5/0.58 1/1'\",format=nv12,hwupload,format=nv12'             -strict experimental   -c:v hevc_vaapi cp.mp4
'curves=all=‘\’0/0 0.5/0.58 1/1‘\’
'curves=all='\'0/0 0.5/0.58 1/1'\'
'curves=all=\'0/0 0.5/0.58 1/1\'
'curves=all='\"0/0 0.5/0.58 1/1\"'
'curves=all=''0/0 0.5/0.58 1/1\''

comment:7 by MasterQuestionable, 5 days ago

͏    You typed wrong content.
͏    `''` is not `"` even if they may look the same under some fonts.

͏    Or use `"` as the outer quote to avoid the havoc.
͏    (but caveat its implication on "$" alike)

͏    Hint: Try with `echo` first.

Last edited 5 days ago by MasterQuestionable (previous) (diff)

comment:8 by elias tsolis, 5 days ago

thanks! i search all over the internet and could not find any example for that. Please, add it as an example to ffmpeg curves guide. It does not take too much time from your side, instead for a use to search a whole day how to do it.

Double quotes (") on outer ffmpeg command can make single quoted (') ffmpeg sub-operands to work very fine, inside these double quotes.

For future reference, I place the whole command:

ffmpeg  -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i vid_original.mp4 -vf "curves=all='0/0 0.8/0.8 1/1',format=nv12, hwupload" -strict experimental   -c:v hevc_vaapi vid_copy.mp4

if I want to update ffmpeg guide, how I can do it?

Version 1, edited 5 days ago by elias tsolis (previous) (next) (diff)

comment:9 by MasterQuestionable, 4 days ago

Resolution: completed (art)
Status: newclosed

͏    Much yes.
͏    Which guide? You may probably directly edit? (if it's the wiki)

͏    If it's the doc on ͏"ffmpeg.org"... (which is generated from Texinfo)
͏    I don't yet understand its syntax and cannot properly edit.
͏    See also: https://trac.ffmpeg.org/ticket/11096#comment:10

͏    The shell command languages is a somewhat convoluted topic:
͏    There are 3 primary shells in use:
͏    |1| Unix Shell (Bash, Dash, Fish, Ksh, Zsh etc.)
͏    |2| Windows CMD
͏    |3| PowerShell
͏    ; each somewhat (or significantly; for CMD) differs in their syntax:
͏    In a much incompatible manner.
͏    .
͏    And cleaning things up may be quite troublesome.
͏    (without having users completely aware of the situation)

Note: See TracTickets for help on using tickets.