AV1 playback in v33

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

AV1 playback in v33

Post by white_haired_uncle »

I'm told that this should work. It does not for me. I don't remember what happens in Recordings (I THINK it's good audio but no video, just like mplayer 1.4 that ships with Ubuntu 22.04LTS, I could create a test case if necessary). In Videos, I get broken up audio and no video for a few seconds, then a video decode error.

VLC and mpv work fine with AV1, including mpv as an external player in Videos. Stock mplayer does not, mplayer I built from svn works, so I guess the next step is to build myth (though I really hope this is just a temporary troubleshooting step). IIRC, last time I tried to build myth I had problems figuring out how to pass config options to ffmpeg (I assume it includes its own ffmpeg?), so any tips appreciated.


2:33.1+fixes.202302200304.c273ed0f9a~ubuntu22.04.1

Code: Select all

Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext tv_play.cpp:2187 (HandleStateChange) TV::HandleStateChange(): Changing from None to WatchingVideo
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: E Decoder avformatdecoder.cpp:3403 (ProcessVideoPacket) AFD: video avcodec_send_packet error: Function not implemented (-38) gotpicture:0
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: E Decoder avformatdecoder.cpp:3403 (ProcessVideoPacket) AFD: video avcodec_send_packet error: Invalid data found when processing input (-1094995529) gotpicture:0
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext mythscreensaverx11.cpp:248 (Disable) ScreenSaverX11: Inhibited X11 screensaver
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext mythscreensaverx11.cpp:128 (DisableDPMS) ScreenSaverX11: DPMS Deactivated 1
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext tv_play.cpp:2263 (HandleStateChange) TV::HandleStateChange(): Main UI disabled.
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext tv_play.cpp:356 (StartTV) TV::StartTV(): Entering main playback loop.
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: E Decoder avformatdecoder.cpp:3395 (ProcessVideoPacket) AFD: video avcodec_receive_frame error: Invalid data found when processing input (-1094995529) gotpicture:0
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: E Decoder avformatdecoder.cpp:3395 (ProcessVideoPacket) AFD: video avcodec_receive_frame error: Invalid data found when processing input (-1094995529) gotpicture:0
...   (error repeats)
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: N CoreContext mythplayer.cpp:782 (PrebufferEnoughFrames) Player(0): Waited 103ms for video buffers AAAAAAAAAAAAAAAA
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: E Decoder avformatdecoder.cpp:3403 (ProcessVideoPacket) AFD: video avcodec_send_packet error: Invalid data found when processing input (-1094995529) gotpicture:0
...   (error repeats)
Mar 21 13:57:59 wolverine mythfrontend.real: mythfrontend[1581]: I CoreContext tv_play.cpp:1955 (HandleStateChange) TV::HandleStateChange(): Attempting to change from WatchingVideo to None

User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: AV1 playback in v33

Post by paulh »

Myth does include it's own ffmpeg.

It looks like the key is Myth needs to be compiled with --enable-libdav1d for AV1 support to be included. It does not look like the Ubuntu packages are built with that enabled so that will be why it does not work for you.

If you want to try compiling your own to enable AV1 support you just need to install libdav1d-dev and libdav1d5 packages and run Myth's configure script with your usual compile flags plus --enable-libdav1d.

If you have both ffmpeg and Myth installed on the same machine you can test AV1 playback using ffmpeg by running ffplay <filename> and mythffplay <filename> to compare how well the system ffmpeg and Myth's ffmeg playback AV1 files.
User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: AV1 playback in v33

Post by paulh »

For reference I don't have any AV1 files to test but using an example I found on github I could play it OK using mythffplay compiled with AV1 support enabled.

Code: Select all

mythffplay https://github.com/SPBTV/video_av1_samples/blob/master/spbtv_sample_bipbop_av1_960x540_25fps.mp4?raw=true

I also added the file to MythVideo and it played OK there as well.

I guess if/when there is demand for AV1 support we could look at enabling it it the Ubuntu builds.
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: AV1 playback in v33

Post by white_haired_uncle »

Built myth with only ./configure --enable-libdav1d.

Watching Video worked beautifully. I ripped an episode from DVD with dd, then encoded with HandBrake using default quality settings for fast 480 for both H.264 and AV1. I can't see any difference between the two, though the AV1 is about half the size (again, just using defaults, not comparing best acceptable compression). And the audio is the same size for both, so the video is actually over 60% smaller for AV1. Nice.

Watching Recordings is a little quirky, though I'll admit my methods may be a little outside the box...

Recorded a program using HDHR. Ran commercial flagging. Cut all but the last few minutes. Ran file through HB with same av1 settings. Set basename,filesize in mysql to point to new av1. Looked really good, until I tried to skip forward (right arrow). Turns out skipping leads to either video decode error, or crashing mythfrontend. Going into edit mode and trying to skip didn't work either. Figured I had an old seektable that didn't match new file.

Code: Select all

mythbackend$ mythcommflag --file /export/video2/2101_20230314010000.av1 --rebuild            
2023-03-22 04:37:10.764450 C  mythcommflag version: fixes/33 [v33.1+fixes.202303020919.c273ed0f9a~ubuntu22.04.1] www.mythtv.org
2023-03-22 04:37:10.764469 C  Qt version: compile: 5.15.3, runtime: 5.15.3
MythTV Commercial Flagger, building seek table for:
    NCIS - Butterfly Effect
Rebuild started at Wed Mar 22 04:37:11 2023
2023-03-22 04:37:11.776848 E  VideoProfile: No window!
2023-03-22 04:37:11.778012 E  VideoProfile: No window!
2023-03-22 04:37:11.782119 E  VideoProfile: No window!
2023-03-22 04:37:11.782177 E  VideoProfile: No window!
No I-frames found, rewinding...
Rebuild completed at Wed Mar 22 04:37:21 2023
2023-03-22 04:37:21.349293 E  decoding error End of file (-541478725)
[Note: I got those same errors when rebuilding seektable on another recording that I didn't mess with, just ran the rebuild to test]

Now I can play the file and skip, though if I try to edit (not that I would ever do that at this point), I get "No Seektable".
[I do not get this error on the other file I ran the rebuild on, edit works fine].

Also, I'm not seeing preview images for this av1. It does create one, and 'file foo.av1.png' shows the same as good previews of other recordings, but it's very small (1.1KB), and blank when viewed with eog. I did not have this issue when I tested using HB to transcode to H264/5 and manually updating recorded table in the past. These are the only references to previewgen I can recognize in the frontend log (and since switching to syslog, I have seen any other logs created like I used to).

Code: Select all

Mar 22 05:21:22 wolverine mythfrontend: mythfrontend[4223]: E CoreContext previewgenerator.cpp:450 (event) Preview: 11851: Failed to read preview image despite preview process returning success.
So, it works well enough for me to go forward with, but there are a few things that might be worth looking at before making the change GA. I wouldn't be surprised if the issues are from something I'm doing, but I didn't have any issues following the same process with H264.5.

@paulh, Thanks for your help getting this working. I've got a lot of transcoding to do, and I'd much rather go straight to av1 now rather than later when it would be a second transcode.
User avatar
kmdewaal
Developer
Posts: 644
Joined: Wed Dec 07, 2016 8:01 pm
Netherlands

Re: AV1 playback in v33

Post by kmdewaal »

It might be a good idea to create a Github issue for AV1 support. This is then a good place to capture the knowledge, what does work and what not, which Internet streams do play and which do not etc.
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: AV1 playback in v33

Post by white_haired_uncle »

kmdewaal wrote:
Wed Mar 22, 2023 8:52 pm
It might be a good idea to create a Github issue for AV1 support. This is then a good place to capture the knowledge, what does work and what not, which Internet streams do play and which do not etc.
Is that comment for me? If so, I'd be happy to do so, but I'd need a nudge in the right direction to get started.
mtvf2894
Junior
Posts: 81
Joined: Sat Apr 10, 2021 2:33 pm
Great Britain

Re: AV1 playback in v33

Post by mtvf2894 »

white_haired_uncle wrote:
Fri Mar 24, 2023 3:19 am
kmdewaal wrote:
Wed Mar 22, 2023 8:52 pm
It might be a good idea to create a Github issue for AV1 support. This is then a good place to capture the knowledge, what does work and what not, which Internet streams do play and which do not etc.
Is that comment for me? If so, I'd be happy to do so, but I'd need a nudge in the right direction to get started.
A vote for me for the "Mythbuntu" builds to support as many codecs as possible.

I think issues are recorded here https://github.com/MythTV/mythtv/issues if you have a Github account - could even link to this thread.
Current: v32 now v33.1 / Lubuntu 22.04 / AMD APU
Previous: v31 / Lubuntu 20.10 / AMD APU
Historic: Mythbuntu / NVIDIA GFX
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: AV1 playback in v33

Post by white_haired_uncle »

If I forgot to install libdav1d-dev, what is the expected result of ./configure --enable-libdav1d ?

I'd like to see it stop with an error, since I'm pretty clearly wanting av1 support, but it didn't and I compiled myth without it.
User avatar
kmdewaal
Developer
Posts: 644
Joined: Wed Dec 07, 2016 8:01 pm
Netherlands

Re: AV1 playback in v33

Post by kmdewaal »

The options in the ./configure command line do indeed specify what you want. But consider this a wish list. In order for your wishes to be fulfilled the libraries must be installed on the system and that is something configure will not do.
After the configure it spits out a report of how the build has actually been configured and it is a good idea to look at that before starting the build.
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: AV1 playback in v33

Post by white_haired_uncle »

kmdewaal wrote:
Fri Aug 18, 2023 5:23 pm
The options in the ./configure command line do indeed specify what you want. But consider this a wish list. In order for your wishes to be fulfilled the libraries must be installed on the system and that is something configure will not do.
After the configure it spits out a report of how the build has actually been configured and it is a good idea to look at that before starting the build.
I don't speak "configure", but it looks to me like a lot of the options will cause configure to fail if they are missing dependencies. I can understand some things pretty much have to, for example anything we know will cause compilation to fail. But some of the others seem pretty arbitrary to me. If I try to include blueray support, configure will abort and warn me I don't have the proper dependencies instead of just disabling blueray support, while if I try to include av1 playback support it will simply disable that option and go ahead and spend potentially hours compiling something which doesn't do what I want it to.

Sure, I should check the configure output more carefully. And if an option was something that was enabled by default, but not necessary for myth to function, I can see just disabling it if dependencies are missing. But since I took the very specific action of setting an option during configure, that doesn't strike me as a request, but a requirement.

Would it not make sense to replace

Code: Select all

enabled libdav1d && use_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d/dav1d.h" dav1d_version || disable libdav1d
with something like

Code: Select all

enabled libdav1d && use_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d/dav1d.h" dav1d_version || die "ERROR: Dav1d >= 0.4.0 required"
Thanks
User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: AV1 playback in v33

Post by paulh »

The difference is probably some options are handled by our configure and others are handled by the ffmpeg configure. We tend to warn and fail if one of our options is specified and the required dependencies are missing but it seems ffmpeg sometimes just disables the option and continues on and expects the user to check the summery before continuing to do the build?
white_haired_uncle
Senior
Posts: 265
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: AV1 playback in v33

Post by white_haired_uncle »

I wondered about ffmpeg, but I was looking at the top level configure (myth) where it is disabled, so I suspect the option never gets to ffmpeg.

(and the comment just above said line is "# Check VA1 support before enabling in FFmpeg")
Post Reply