[Cin] so, it looks like qsv integration a bit harder than just adding few lines ....
Terje J. Hanssen
terjejhanssen at gmail.com
Sat Sep 28 17:35:23 CEST 2024
Den 28.09.2024 01:22, skrev Andrew Randrianasulu:
>
>
> пт, 27 сент. 2024 г., 23:27 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>
>
> Den 27.09.2024 19:45, skrev Andrew Randrianasulu:
>>
>>
>> пт, 27 сент. 2024 г., 18:55 Terje J. Hanssen
>> <terjejhanssen at gmail.com>:
>>
>>
>>
>> Den 27.09.2024 12:44, skrev Andrew Randrianasulu:
>>>
>>>
>>> пт, 27 сент. 2024 г., 12:40 Terje J. Hanssen
>>> <terjejhanssen at gmail.com>:
>>>
>>>
>>>
>>> Den 26.09.2024 01:18, skrev Andrew Randrianasulu:
>>>>
>>>>
>>>> On Thu, Sep 26, 2024 at 2:06 AM Terje J. Hanssen
>>>> <terjejhanssen at gmail.com> wrote:
>>>>
>>>>
>>>>
>>>> Den 25.09.2024 23:22, skrev Andrew Randrianasulu:
>>>>>
>>>>>
>>>>> чт, 26 сент. 2024 г., 00:16 Terje J. Hanssen
>>>>> <terjejhanssen at gmail.com>:
>>>>>
>>>>>
>>>>>
>>>>> Den 25.09.2024 21:33, skrev Andrew Randrianasulu:
>>>>>>
>>>>>>
>>>>>> ср, 25 сент. 2024 г., 18:25 Terje J. Hanssen
>>>>>> <terjejhanssen at gmail.com>:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Den 25.09.2024 00:27, skrev Andrew
>>>>>> Randrianasulu:
>>>>>>> try this git patch, do not forgot to
>>>>>>> make install again, or put profiles in
>>>>>>> bin/ffmpeg/video folder manually.
>>>>>>
>>>>>> # cd /home/cinelerra/cinelerra-5.1
>>>>>> # mv
>>>>>> /home/terje/0001-Qsv-encoders-for-testing.patch
>>>>>> .
>>>>>>
>>>>>> # git am 0001-Qsv-encoders-for-testing.patch
>>>>>> Applying: Qsv encoders for testing
>>>>>>
>>>>>>
>>>>>> make install > make_install.log 2&1
>>>>>>
>>>>>>
>>>>>>
>>>>>> make install > make_install.log 2>&1 ?
>>>>>>
>>>>> Sorry. I should cleanup all ">" with Find &
>>>>> Replace in my note, and oversaw here should be
>>>>> two of them in this command ;(
>>>>>
>>>>> Now make install went through without faults
>>>>> as I could see, but attach it by email again.
>>>>>
>>>>> But unhappily, no success with testing Cingg
>>>>> Qsv Rendering.
>>>>> All attempts so far breaks with the output below:
>>>>>
>>>>> FFMPEG::open_encoder err: Internal bug,
>>>>> should not have happened
>>>>> int FFMPEG::open_encoder(const char*,
>>>>> const char*):
>>>>>
>>>>> ----------
>>>>> localhost:/home/cinelerra/cinelerra-5.1 # bin/cin
>>>>> Cinelerra Infinity - built: Sep 23 2024 10:31:07
>>>>> ----------
>>>>> 1)
>>>>> Loaded hdv09_04.m2t
>>>>> Render:
>>>>> Output to file:
>>>>> /Videoklipp/QSV/hdv09_04_h264_qsv.mp4
>>>>> File format: FFMPEG-mp4
>>>>> Compression: h264_qsv.mp4
>>>>> Pixels: qsv
>>>>>
>>>>> 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_21
>>>>> 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_21
>>>>> libva info: va_openDriver() returns 0
>>>>>
>>>>> FFMPEG::open_encoder err: Internal bug,
>>>>> should not have happened
>>>>> int FFMPEG::open_encoder(const char*, const
>>>>> char*):
>>>>> open failed
>>>>> h264_qsv:/Videoklipp/QSV/hdv09_04_h264_qsv.mp4
>>>>> Render::render_single: Session finished.
>>>>> --------------
>>>>> 2a)
>>>>> Loaded hdv09_04.m2t
>>>>> Render:
>>>>> Output to file:
>>>>> /Videoklipp/QSV/hdv09_04_h265_qsv.mp4
>>>>> File format: FFMPEG-mp4
>>>>>
>>>>> Compression: h265_qsv.mp4
>>>>> Pixels: qsv
>>>>>
>>>>> [hevc_qsv encoder @ 0x7f44e0d0bd80] [Eval @
>>>>> 0x7f44e57eb6f0] Undefined constant or missing
>>>>> '(' in 'high'
>>>>> [hevc_qsv encoder @ 0x7f44e0d0bd80] Unable to
>>>>> parse option value "high"
>>>>> [hevc_qsv encoder @ 0x7f44e0d0bd80] Error
>>>>> setting option profile to value high.
>>>>> FFMPEG::open_encoder err: Invalid argument
>>>>> int FFMPEG::open_encoder(const char*, const
>>>>> char*):
>>>>> open failed
>>>>> hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
>>>>> Render::render_single: Session finished.
>>>>>
>>>>
>>>> # profile=high
>>>> Pixels: qsv (yuv420 isn't available)
>>>>
>>>> Didn't render:
>>>> FFMPEG::open_encoder err: Internal bug, should not
>>>> have happened
>>>> int FFMPEG::open_encoder(const char*, const char*):
>>>> open failed
>>>> hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
>>>> Render::render_single: Session finished.
>>>>
>>>>
>>>>
>>>>> ----------------
>>>>> 2b)
>>>>> Compression: h265_qsv.mp4
>>>>> Pixels: p010le
>>>>>
>>>>> [hevc_qsv encoder @ 0x7f93dcdb3c00] [Eval @
>>>>> 0x7f93cbff06f0] Undefined constant or missing
>>>>> '(' in 'high'
>>>>> [hevc_qsv encoder @ 0x7f93dcdb3c00] Unable to
>>>>> parse option value "high"
>>>>> [hevc_qsv encoder @ 0x7f93dcdb3c00] Error
>>>>> setting option profile to value high.
>>>>> FFMPEG::open_encoder err: Invalid argument
>>>>> int FFMPEG::open_encoder(const char*, const
>>>>> char*):
>>>>> open failed
>>>>> hevc_qsv:/Videoklipp/QSV/hdv09_04_h265_qsv.mp4
>>>>> Render::render_single: Session finished.
>>>>>
>>>>
>>>> Some progress:
>>>>
>>>> # profile=high
>>>> Pixels: yuvy422 (yuv420 isn't available)
>>>> Settings>Appearance: BT.709/MPEG2
>>>>
>>>> Rendered:
>>>> Render::render_single: Session finished.
>>>> ** rendered 5972 frames in 33.999 secs, 175.652 fps
>>>> audio0 pad 64 0 (64)
>>>>
>>>> VLC playback OK
>>>>
>>>> ffprobe -hide_banner hdv09_04_h265_qsv.mp4
>>>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
>>>> 'hdv09_04_h265_qsv.mp4':
>>>> Metadata:
>>>> major_brand : isom
>>>> minor_version : 512
>>>> compatible_brands: isomiso2mp41
>>>> encoder : Lavf61.1.100
>>>> Duration: 00:03:58.88, start: 0.000000, bitrate:
>>>> 3359 kb/s
>>>> Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 /
>>>> 0x31766568), yuv422p(tv, bt709/unknown/unknown, top
>>>> coded first (swapped)), 1440x1080 [SAR 4:3 DAR
>>>> 16:9], 3223 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, 129 kb/s (default)
>>>> Metadata:
>>>> handler_name : SoundHandler
>>>> vendor_id : [0][0][0][0]
>>>>
>>>>
>>>>
>>>> ah, so it need tv range .. try also with Pixels nv12
>>>> (worked for me on mediacodec)
>>>
>>> Not really.,
>>> Also the default at first startup, appearance
>>> BT.601-PAL/MJPEG, worked, and then ffprobe output
>>> Stream #0:0[0x1](und): Video: hevc (Rext) (hev1 /
>>> 0x31766568), yuv422p(pc, bt470bg/unknown/unknown, top
>>> coded first (swapped)), 1440x1080 [SAR 4:3 DAR 16:9],
>>> 3248 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
>>>
>>> I just changed it to BT.701/MPEG which is for HD video,
>>> and I also remembed you also suggested this in a
>>> previous thread.
>>>
>>> Both yuv422 and nv12 work.
>>>
>>> But why isn't also the usual yuv420p available for h264
>>> and h265?
>>>
>>>
>>> not sure, may be qsv library does not support this?
>>>
>>> at least I can't see it in source
>>>
>>> https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavcodec/qsvenc_hevc.c#l399
>>>
>>>
>>>
>>> Possibly also rename h265 to hevc as ffmpeg use?
>>>
>>>
>>> ok, I'll rename it and add nv12 as default pix format.
>>>
>>> can you also see if h264 works with nv12?
>>
>> No, h264 doesn't work with nv12, neither with # profile=high
>>
>> I've extracted three ffmpeg QSV code lines below with qsv and
>> yuv420p used from
>> https://trac.ffmpeg.org/wiki/Hardware/QuickSync#FullExamples
>>
>> ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf
>> hwdownload,format=nv12 -pix_fmt yuv420p output.yuv
>> ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf
>> hwdownload,format=nv12 -pix_fmt yuv420p -f sdl -
>> ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -f
>> rawvideo -pix_fmt yuv420p -s:v 1920x1080 -i input.yuv -vf
>> hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -b:v 5M
>> output.mp4
>>
>>
>> On the other hand the following VAAPI section and code lines from
>> 'The encoders only accept input as VAAPI surfaces. If the
>> input is in normal memory, it will need to be uploaded before
>> giving the frames to the encoder - in the ffmpeg utility, the
>> |hwupload| filter can be used for this. It will upload to a
>> surface with the same layout as the software frame, so it may
>> be necessary to add a |format| filter immediately before to
>> get the input into the right format (hardware generally wants
>> the |nv12| layout, but most software functions use the
>> |yuv420p| layout). The |hwupload| filter also requires a
>> device to upload to, which needs to be defined before the
>> filter graph is created.'
>>
>> ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -vf
>> 'format=nv12,hwupload' -c:v h264_vaapi output.mp4
>>
>>
>> and from my own ffmpeg test
>>
>> ffmpeg -hide_banner -hwaccel_output_format qsv -i
>> hdv09_04.m2t hdv09_04_h264_qsv.mp4
>>
>>
>>
>> note that this line uses *software* x264 encoder, not qsv.
>
> Yeah, I was confused by the "-hwaccel_output_format qsv"
> See below for another attempt
>
>>
>> Does av1_qsv/vp9_qsv works? Can you also try with progressive
>> (not interlaced) video?
>>
> Sorry, none of av1_qsv nor vp9_qsv pixel formats work (interlaced
> hdv input)
> I was looking for a progressive video to download?
>
>
> you can try to add deinterlacing filter in cingg? Do not forgot to set
> format- > interlacing to progressive.
>
>
> But I tested "h284_qsv/nv12/profile high" rendering wiht SD-DV
> file (interlaced) and it worked
>
> FFStream::encode_frame: encode failed.
> file: /Videoklipp/QSV/dv01_07_h264_qsv.mp4
> err: Resource temporarily unavailable
> FFStream::flush failed
> :file:/Videoklipp/QSV/dv01_07_h264_qsv.mp4
> err: Operation not permitted
> Render::render_single: Session finished.
> ** rendered 2832 frames in 5.592 secs, 506.438 fps
> audio0 pad 32 0 (32)
>
> ---------------------
>
>
>
> so, h264/5 qsv in cingg works, but vp9/av1 not?
>
> I'll add two more silly patches as attachment, they hopefully correct
> hevc/h264 profiles and add remark about how they only usable with ext.
> ffmpeg (for now).
>
> Sorry about such extended debugging. Thanks for patience (over the years!)
>
I did a summary testing today with results before patching:
1)
dv_movie.mpg (progressive)
dv01_07.dv (interlaced)
av1_qsv/vp9_qsv rendering works with nv12 and p010le
h264_qsv rendering works with nv12
2)
hdv09_04.m2t (interlaced)
av1_qsv/vp9_qsv nv12/p010le error ...
h264_qsv nv12 error ...
hevc_qsv nv12/p010le does render #high profile
hdv_movie_0.mpg (progressive)
av1_qsv/vp9_qsv nv12/p010le error ...
h264_qsv nv12 error ...
hevc_qsv nv12/p010le does render #high profile
3)
hd01.mov (interlaced)
av1_qsv/vp9_qsv nv12/p010le error ...
h264_qsv nv12 error ...
hevc_qsv nv12/p010le does render #high profile
---------------------------
After adding the latest two patches and make install, 1) above doesn't
work anymore.
Tried also to comment out each of the two new options.
Any idea why?
I have not continued with 2) and 3) above so far.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240928/3b44593b/attachment-0001.htm>
More information about the Cin
mailing list