On Wed, Oct 23, 2024 at 2:59 PM Terje J. Hanssen <terjejhanssen@gmail.com> wrote:



Den 23.10.2024 03:10, skrev Andrew Randrianasulu:
Try to set vprofile instead of profile?

Doesn't this correspond to what we previously also discussed for ffmpeg 7.0.2?

ffmpeg as cli does its own option processing, as far as I understand.

Using av_dict_* functions in c++ code was working with libav*/ffmpeg libs up to 7.0
but evidently not after..

I'll look into what ffmpeg cli does now, but if more changes in pipeline may be we better to skip 7.1 completely?

I also do not know why output become progressive (flagged?) after upgrade. May be some default changed.

Sorry, but can I suggest to put this build aside and retry with 7.0 built-in (+libvpl patch) so at least we will have point of reference?
 

Re: [Cin] FFmpeg supported QSV pixel formats and profiles 12.10.2024, 15:59
https://lists.cinelerra-gg.org/pipermail/cin/2024-October/008811.html

>>> I think we can concentrate on av1 for now.
>>> does it fail if you add "-profile main" to ffmpeg command line for dv av1 encode?
>>> dv due to it being software codec, so ffmpeg forced to push and convert frames from system memory, as opposed to hdv (hw) = > av1 on-gpu transcode)

>> No, it doesn't fail:
>> but claims:
>> "Please use -profile:a or -profile:v, -profile is ambiguous"

> ah, I think it mostly relevant to ffmpeg as cli application.


Cingg renders standard PAL DV 5765i when the h264_qsv "profile" is changed to "vprofile",
though there are some other fail/err messages in the output

libva info: va_openDriver() returns 0
FFStream::encode_frame: encode failed.
file: /Videoklipp/QSV/dv01_07_h264_qsv_nv12.mp4
  err: Resource temporarily unavailable
FFStream::flush failed
:file:/Videoklipp/QSV/dv01_07_h264_qsv_nv12.mp4
  err: Operation not permitted
Render::render_single: Session finished.
** rendered 2832 frames in 5.291 secs, 535.249 fps
audio0 pad 32 0 (32)



Looks like this rendering automatic deinterlace DV

ffprobe -hide_banner dv01_07.dv
[dv @ 0x55613dce4140] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'dv01_07.dv':
  Metadata:
    timecode        : 01:09:35:09
  Duration: 00:01:53.28, start: 0.000000, bitrate: 28800 kb/s
  Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, 60k fps, 25 tbr, 60k tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s


ffprobe -hide_banner dv01_07_h264_qsv_nv12.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'dv01_07_h264_qsv_nv12.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.7.100
  Duration: 00:01:53.28, start: 0.000000, bitrate: 2798 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown, progressive), 720x576 [SAR 16:15 DAR 4:3], 2674 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]

----------------

For invalid picture structure .. does it go away if you deinterlace video track?

So far standard PAL 1080i HDV is not accepted as input for h264_qsv rendering, which is too bad (tested it worked as deinterlaced to DV 16:9)

------------

i suspect that we should focus on one ffmpeg version that was working (7.0) instead of chasing new and improved breackage

For me it looks like the interface? issues lay more on the Cin side, because my three tested command line variants for av1_qsv encoding work for ffmpeg 7.1 as well as on the 7.0.2 predecessor:

ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -i hdv09_04.m2t -c:v av1_qsv hdv09_04_av1_qsv.webm

ffmpeg -hide_banner -hwaccel_output_format qsv -qsv_device /dev/dri/renderD128 -extra_hw_frames 16 -i hdv09_04.m2t -c:v av1_qsv -preset 4 -b:v 3700k hdv09_04_av1_qsv_pr4_bv3700k.webm

ffmpeg -hide_banner -hwaccel_output_format qsv -i hdv09_04.m2t -pix_fmt p010le -c:v av1_qsv hdv09_04_av1_qsv_p010le.webm


745M    hdv09_04.m2t
47M     hdv09_04_av1_qsv_p010le.webm
111M    hdv09_04_av1_qsv_pr4_bv3700k.webm
47M     hdv09_04_av1_qsv.webm


ffprobe -hide_banner hdv09_04_av1_qsv_pr4_bv3700k.webm
Input #0, matroska,webm, from 'hdv09_04_av1_qsv_pr4_bv3700k.webm':
  Metadata:
    ENCODER         : Lavf61.7.100
  Duration: 00:03:59.08, start: -0.007000, bitrate: 3881 kb/s
  Stream #0:0: Video: av1 (libdav1d) (Main), yuv420p(tv, bt709), 1440x1080, SAR 4:3 DAR 16:9, 25 fps, 25 tbr, 1k tbn
      Metadata:
        ENCODER         : Lavc61.19.100 av1_qsv
        DURATION        : 00:03:59.080000000
  Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp
      Metadata:
        ENCODER         : Lavc61.19.100 libopus
        DURATION        : 00:03:58.784000000


------------------

Looking at ffmpeg vs the content of cingg's av1_qsv "profiles" again, I wonder why the latter don't contain a "vprofile" line?


ffmpeg -hide_banner -h encoder=av1_qsv | egrep 'Supported|profile|main'
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 p010le qsv
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     main            1            E..V.......


/Cin/bin/ffmpeg/video> ls av1_qsv*
av1_qsv.dfl  av1_qsv.mp4  av1_qsv.webm

cat av1_qsv.dfl
av1_qsv.webm

cat av1_qsv.mp4
mp4 av1_qsv
# only usable with ext. ffmpeg
cin_pix_fmt=nv12

cat av1_qsv.webm
webm av1_qsv
# only usable with ext. ffmpeg
cin_pix_fmt=nv12





On Wed, Oct 23, 2024 at 2:49 AM Terje J. Hanssen <terjejhanssen@gmail.com> wrote:



Den 23.10.2024 00:18, skrev Andrew Randrianasulu:


вт, 22 окт. 2024 г., 21:52 Terje J. Hanssen <terjejhanssen@gmail.com>:



Den 22.10.2024 17:04, skrev Andrew Randrianasulu:

[snip]


Yes, thanks for the help. I used

 #export CFLAGS=-I/usr/include/ffmpeg

and then the rest worked fine.

Enough for me today !



This rebuild cingg to use ffmpeg 7.1 startup ok and testing DV rendering to  av1_qsv_nv12.mp4, av1_qsv_nv12.webm and also av1_qsv_p010le.webm work.

But the same rendering from hdv does not longer work, tried also with BT.709 setting.

does ffmpeg 7.1 itself work for this type of encoding and same input file ?

Yes, I tried three varants of ffmpeg codelines, and all renderend hdv to av1_qsv.webm ok


Do h264/hevc qsv encoders still work?

No, I got the following Cingg output errors:

looks like ffmpeg changed some parsing code :/
you can try to replace high/main words with numbers like 0,1 but .....it will be sad if one set of profiles will not work for pre 7.1 and 7.1 :/

I got hevc_qsv to work both with uncommenting # profile and by setting profile=0 and profile=1

libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
Render::render_single: Session finished.
** rendered 5972 frames in 20.861 secs, 286.276 fps
audio0 pad 64 0 (64)


libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
Render::render_single: Session finished.
** rendered 5972 frames in 21.269 secs, 280.784 fps
audio0 pad 64 0 (64)


libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
Render::render_single: Session finished.
** rendered 5972 frames in 22.176 secs, 269.300 fps
audio0 pad 64 0 (64)

-----------------

But h264_qsv didn't work similar ..........

libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[h264_qsv @ 0x7f4108127880] Current picture structure is unsupported
[h264_qsv @ 0x7f4108127880] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
Render::render_single: Session finished.


libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[h264_qsv @ 0x7f40c03e6dc0] Current picture structure is unsupported
[h264_qsv @ 0x7f40c03e6dc0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
Render::render_single: Session finished.


libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[h264_qsv @ 0x7f40b805bc80] Current picture structure is unsupported
[h264_qsv @ 0x7f40b805bc80] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
Render::render_single: Session finished.


[h264_qsv @ 0x7f40a4038880] [Eval @ 0x7f40d97f36d0] Undefined constant or missing '(' in 'main'
[h264_qsv @ 0x7f40a4038880] Unable to parse option value "main"
[h264_qsv @ 0x7f40a4038880] Error setting option profile to value main.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
Render::render_single: Session finished.
Total excess of backups: -50
Session time: 0:16:31
Cpu time: user: 0:02:54.493 sys: 0:00:12.204


 

thanks for testing .....



[h264_qsv @ 0x7f4c88107880] [Eval @ 0x7f4cb37f76d0] Undefined constant or missing '(' in 'high'
[h264_qsv @ 0x7f4c88107880] Unable to parse option value "high"
[h264_qsv @ 0x7f4c88107880] Error setting option profile to value high.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv_nv12.mp4
Render::render_single: Session finished.


[hevc_qsv @ 0x7f4c8406b180] [Eval @ 0x7f4cb8ff26d0] Undefined constant or missing '(' in 'main'
[hevc_qsv @ 0x7f4c8406b180] Unable to parse option value "main"
[hevc_qsv @ 0x7f4c8406b180] Error setting option profile to value main.
FFMPEG::open_encoder  err: Invalid argument
int FFMPEG::open_encoder(const char*, const char*):
open failed hevc_qsv:/Videoklipp/QSV/hdv09_04_hevc_qsv_nv12.mp4
Render::render_single: Session finished.

I forgot to mention that I haven't applied specific patches to the last built based on ffmpeg 7.1, other than the copied profiles from previous built based on ffmpeg 7.0.2

Have made a shortcut symlink /Cin

ls -l /Cin
lrwxrwxrwx 1 root root 29 Oct 22 20:23 /Cin -> /home/cinelerra/cinelerra-5.1

localhost:/Cin/bin/ffmpeg/video #

# ls *_qsv*
av1_qsv.dfl  av1_qsv.mp4  av1_qsv.webm  h264_qsv.mp4  h265_qsv.mp4  hevc_qsv.mp4  vp9_qsv.mp4

Here the h264/hevc qsv profiles contain:

# cat h264_qsv.mp4
mp4 h264_qsv
# only usable with ext. ffmpeg
profile=high
cin_pix_fmt=nv12

# cat hevc_qsv.mp4
mp4 hevc_qsv
# only usable with ext. ffmpeg, another pixfmt is yuyv422
profile=main
cin_pix_fmt=nv12
 

The current av1_qsv profiles contents are as follows (tried to copy them from previous ffmpeg 7.0.2 backup):

localhost:/home/cinelerra/cinelerra-5.1/bin/ffmpeg/video #

cat av1_qsv.dfl
av1_qsv.webm

cat av1_qsv.mp4
mp4 av1_qsv
# only usable with ext. ffmpeg
cin_pix_fmt=nv12

cat av1_qsv.webm
webm av1_qsv
# only usable with ext. ffmpeg
cin_pix_fmt=nv12
------------

As shown in the Cingg output below:
[av1_qsv @ 0x7f4788de7200] Current picture structure is unsupported
[av1_qsv @ 0x7f4788de7200] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented


Output format and profile from system ffmpeg 7.1 looks similar like from previous 7.0.2

ffmpeg -hide_banner -h encoder=av1_qsv | egrep 'Supported|profile|main'
    Supported hardware devices: qsv qsv qsv
    Supported pixel formats: nv12 p010le qsv
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     main            1            E..V.......

Any idea what cause this hd(v) rendering errors now in the built Cingg?


# bin/cin
Cinelerra Infinity - built: Oct 20 2024 21:21:06

libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[av1_qsv @ 0x7f4788de7200] Current picture structure is unsupported
[av1_qsv @ 0x7f4788de7200] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed av1_qsv:/Videoklipp/QSV/hdv09_04_av1_qsv_nv12.webm
Render::render_single: Session finished.

-----------------

libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
[av1_qsv @ 0x7f47b0040840] Current picture structure is unsupported
[av1_qsv @ 0x7f47b0040840] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
FFMPEG::open_encoder  err: Function not implemented
int FFMPEG::open_encoder(const char*, const char*):
open failed av1_qsv:/Videoklipp/QSV/hdv09_04_av1_qsv_p010le.webm
Render::render_single: Session finished.
Total excess of backups: -50
Session time: 0:06:36
Cpu time: user: 0:00:08.543 sys: 0:00:03.847
unjoined tids / owner 2
  00007f47c5ffb6c0 / 00007f48377fe6c0 12RenderEngine
  00007f47c7fff6c0 / 00007f48377fe6c0 12RenderEngine