[mythtv] AVC Baseline Profile support

Scott Theisen scott.the.elm at gmail.com
Wed Jul 6 23:24:35 UTC 2022


On 7/6/22 03:41, Piotr Oniszczuk wrote:
>
>> Wiadomość napisana przez Scott Theisen<scott.the.elm at gmail.com>  w dniu 05.07.2022, o godz. 20:05:
>>
>> On 7/5/22 04:37, Piotr Oniszczuk wrote:
>>> It looks i was wrong saying: .mkv sample plays ok in current master.
>>> .mkv sample fails on current master with vdpau/vaapi api
>>> but plays ok with hw decoding on current master (and also on ffmpeg-resync) with: v4l2_request and v4l2_m2m api
>>>
>>> So issue is rather no fmpeg-resync regression - but rather more general regression in current master:-(
>>>
>>> If this will be helpful - pls find 2 logs:
>>> -failing on n3450 vaapi; ffmpeg-resync : hxxp://warped.inet2.org/failing.log
>>> -working on h6 v4l2_request; ffmpeg-resync: hxxp://warped.inet2.org/ok.log
>> You website is asking for a login, so I can't look at your logs.
> Ah i'm sorry.
> Now should be ok :-p

Just to clarify the behavior when you say failing on n3450, do you mean 
it doesn't decode at all or just that it doesn't use hardware acceleration?

Noteworthy lines from failing.log:
```
2022-07-05 09:48:55.647891 I [5383/5383] CoreContext 
mythvideoprofile.cpp:305 (MythVideoProfile) - VideoProfile: Accepting: 
cmp() w() h() framerate() codecs( ) dec(vaapi) cpus(2) skiploop(enabled) 
rend(opengl-hw) deint(high:shader:driver,high:shader:driver) 
upscale(bilinear)
2022-07-05 09:48:55.647910 I [5383/5383] CoreContext 
mythvideoprofile.cpp:305 (MythVideoProfile) - VideoProfile: Accepting: 
cmp() w() h() framerate() codecs( ) dec(ffmpeg) cpus(2) 
skiploop(enabled) rend(opengl-yv12) deint(medium:shader,medium:shader) 
upscale(bilinear)
...
2022-07-05 09:48:56.257242 I [5383/5383] CoreContext 
mythvideoprofile.cpp:446 (LoadBestPreferences) - VideoProfile: 
LoadBestPreferences(1920x1080, 50.000, h264)
2022-07-05 09:48:56.257265 I [5383/5383] CoreContext 
mythvideoprofile.cpp:471 (LoadBestPreferences) - VideoProfile: 
LoadBestPreferences result: priority:1 width: height: fps: codecs:
2022-07-05 09:48:56.257273 I [5383/5383] CoreContext 
mythvideoprofile.cpp:476 (LoadBestPreferences) - VideoProfile: 
decoder:vaapi renderer:opengl-hw deint0:high:shader:driver 
deint1:high:shader:driver cpus:2 upscale:bilinear
2022-07-05 09:48:56.257324 I [5383/5383] CoreContext 
mythvaapicontext.cpp:152 (GetSupportedCodec) - VAAPIDec: VAAPI does not 
support decoding 'h264 Baseline yuv420p'
2022-07-05 09:48:56.257334 I [5383/5383] CoreContext 
avformatdecoder.cpp:2304 (ScanStreams) - AFD: Unavailable decoders: vaapi
```

Your Intel N3450 has 4 cores, why use only 2 of them?

Your sample, h264-Sat_1080i_25fps.mkv, has a video stream using AVC 
Baseline Profile.  libva has deprecated ( 
https://github.com/intel/libva/commit/6f69256f8ccc9a73c0b196ab77ac69ab1f4f33c2 
) this on 2017-09-17 saying:
```
Deprecate H.264 baseline profile and FMO support

This is not now and never will be supported by any hardware, nor is
it supported by any current software.

```

If I understand what the Baseline Profile enables, the video stream 
should not decode properly if it actually uses those features. Since it 
presumably did decode properly using hardware acceleration, the video 
stream is probably a mislabeled Constrained Baseline.

Could you get the output of `vainfo` on your Intel system?

Try this (raises a -Wdeprecated-declarations)
```
diff --git a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp 
b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
index 514eec029b..ba9751c871 100644
--- a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
+++ b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
@@ -68,6 +68,7 @@ VAProfile MythVAAPIContext::VAAPIProfileForCodec(const 
AVCodecContext* Codec)
          case AV_CODEC_ID_H264:
              switch (Codec->profile)
              {
+                case FF_PROFILE_H264_BASELINE: return 
VAProfileH264Baseline;
                  case FF_PROFILE_H264_CONSTRAINED_BASELINE: return 
VAProfileH264ConstrainedBaseline;
                  case FF_PROFILE_H264_MAIN: return VAProfileH264Main;
                  case FF_PROFILE_H264_HIGH: return VAProfileH264High;
```

or this hack:
```
diff --git a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp 
b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
index 514eec029b..c3a0550687 100644
--- a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
+++ b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
@@ -68,6 +68,7 @@ VAProfile MythVAAPIContext::VAAPIProfileForCodec(const 
AVCodecContext* Codec)
          case AV_CODEC_ID_H264:
              switch (Codec->profile)
              {
+                case FF_PROFILE_H264_BASELINE: // XXX HACK: assume 
mislabeled and hope for the best
                  case FF_PROFILE_H264_CONSTRAINED_BASELINE: return 
VAProfileH264ConstrainedBaseline;
                  case FF_PROFILE_H264_MAIN: return VAProfileH264Main;
                  case FF_PROFILE_H264_HIGH: return VAProfileH264High;
```

>
>>> btw:
>>> i also discover current master fails hw decode on mesa/vaapi
>>> hw decode ok but with black screen on mesa/vdpau
>>> ....but this is another issue
>> It is probably best to open a new issue on GitHub so this thread stays on topic.
> I looked closer on mesa thing.
> After mesa update, rebuild, make sure llvm cooperates ok with mesa and various tests i see:
> -current mesa/vaapi works ok on current master.
> -current mesa/vaapi not works on ffmpeg-resync.
>
> So maybe we will return to testing mesa/vaapi on ffmpeg-resync when we fix my .mkv sample decoding issue?
>   
> br

What doesn't work?

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20220706/60e7fa8b/attachment.htm>


More information about the mythtv-dev mailing list