[Cin] two more h264_vaapi profile for cingg

Andrew Randrianasulu randrianasulu at gmail.com
Thu May 26 04:17:09 CEST 2022


On Thursday, May 26, 2022, Andrew Randrianasulu <randrianasulu at gmail.com>
wrote:

>
>
> On Thursday, May 26, 2022, Andrew Randrianasulu <randrianasulu at gmail.com>
> wrote:
>
>>
>>
>> On Thursday, May 26, 2022, Andrew Randrianasulu <randrianasulu at gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Thursday, May 26, 2022, Phyllis Smith via Cin <
>>> cin at lists.cinelerra-gg.org> wrote:
>>>
>>>> Checked these 2 into GIT after testing.  About the following:
>>>>
>>>> Instead "h264_vaapi.mkv" gives me error and no rendering.
>>>>>
>>>>> Error message popup:
>>>>> "error rendering data"
>>>>>
>>>>> On terminal:
>>>>> FFMPEG::encode_activate: write header failed /home/paz/vaapi_test.mkv
>>>>>   err: Invalid data found when processing input
>>>>> Render::render_single: Session finished.
>>>>>
>>>>
>>>> I added a message to the format to state that the mkv "only works on
>>>> computer that has vaapi capable software and hardware".  I got the same
>>>> error message as Andrew on my AMD laptop that does not handle vaapi, but an
>>>> old HP laptop has it working.  Not exactly sure that is the correct reason
>>>> but it is all I could think of.  Correct me if I am wrong.
>>>>
>>>
>>> may be mkv muxer in ffmpeg more strict (or buggy)?
>>>
>>> if you try to re-mux vaapi-encoded h264 mp4 into mkv with ffmpeg -i
>>> file.mp4 -c:v copy (..other params) file.mkv - does it work?
>>>
>>
>>
>> at least for some user it was not working in ~2020... may be AMD
>> driver/firmware need some support?
>>
>>
>> https://forums.gentoo.org/viewtopic-t-1107846-start-0.html
>>
>
>
> ah, googling exact error showed up solution in this bug:
>
> https://gitlab.freedesktop.org/mesa/mesa/-/issues/2351
>
> should be fixed if your mesa has commits from:
>
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4184/commits
>
> but may be latest nesa reintroduced this bug...?
>
> Also, you can try this bsf metadata option... (not sure how to use it yet)
>



https://www.ffmpeg.org/ffmpeg-bitstream-filters.html#toc-dump_005fextra

===
For example the following ffmpeg command forces a global header (thus
disabling individual packet headers) in the H.264 packets generated by the
libx264 encoder, but corrects them by adding the header stored in extradata
to the key packets:

ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v
dump_extra out.ts

===

if modification of such command work for ffmpeg vaapi encoding and muxing
into mkv on AMD hardware (!) we hopefully can add this to our newly-added
profile?

It seems ffmpeg.C already supports adding bitstream filters at encoder
side...

Successfully rebased and updated refs/heads/master.
$ cd cinelerra/
$ grep av_bsf ffmpeg.C
        if( bsfc ) av_bsf_free(&bsfc);
                ret = av_bsf_send_packet(bsfc, pkt);
                        if( (ret=av_bsf_receive_packet(bsfc, bs)) < 0 ) {
                ret = av_bsf_list_parse_str(bsfilter, &fst->bsfc);
$ mcedit ffmpeg.C

---

you can look up av_bsf_list_parse_str documentation....

https://ffmpeg.org/doxygen/3.2/group__lavc__misc.html#gacc7bbd4bb41b36893f6ad971fd95f7fb

===

int av_bsf_list_parse_str ( const char * str,
AVBSFContext ** bsf
)
Parse string describing list of bitstream filters and create single
AVBSFContext describing the whole chain of bitstream filters.

Resulting AVBSFContext can be treated as any other AVBSFContext freshly
allocated by av_bsf_alloc().

Parameters
str String describing chain of bitstream filters in format
bsf1[=opt1=val1:opt2=val2][,bsf2]

[out] bsf Pointer to be set to newly created AVBSFContext structure
representing the chain of bitstream filters
Returns
>=0 on success, negative AVERROR in case of failure

===

and try to have fun with h264_metadata (try rotation as example?) by
modifying one from our h264 profiles (temporarily)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20220526/0dbc18a9/attachment-0001.htm>


More information about the Cin mailing list