bplaum / gmerlin-avdecoder

Gmerlin audio/video decoder library
GNU General Public License v2.0
2 stars 1 forks source link

Crash while playing MXF-files (ProRes codec) #5

Closed umlaeute closed 10 months ago

umlaeute commented 1 year ago

While trying to debug https://github.com/umlaeute/Gem/issues/297, I noticed that Gmerlin cannot properly decode MXF-Files (at least when using Apple's ProRes/4444 codec).

Sample files can be obtained from https://www.arri.com/en/learn-help/learn-help-camera-system/camera-sample-footage-reference-image in the "ALEXA Mini LF MXF/Apple ProRes" section.

$ mediainfo "2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf
General
Complete name                            : 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf
Format                                   : MXF
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Open / Incomplete
File size                                : 870 MiB
Duration                                 : 8 s 42 ms
Overall bit rate                         : 908 Mb/s
Encoded date                             : 2021-09-30 12:04:06.000
Writing application                      : ARRI ALEXA Mini LF SUP 7.01.00

Video
ID                                       : 2
Format                                   : ProRes
Format version                           : Version 1
Format profile                           : 4444
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D010301021C0100-0401020203060500
Duration                                 : 8 s 42 ms
Bit rate                                 : 902 Mb/s
Width                                    : 2 880 pixels
Original width                           : 3 072 pixels
Height                                   : 2 880 pixels
Display aspect ratio                     : 2.000
Frame rate                               : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:4:4
Bit depth                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 4.531
Stream size                              : 865 MiB (99%)
Writing library                          : Arnold & Richter Cine Technik
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.709

Gmerlin segfaults with:

$ gmerlin-play "2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf"
no more csLADSPA plugins
Setting audio stream 0
Setting subtitle stream -1
[mxf] Couldn't find partition for source package 0
[pluginregistry] Opening 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf with "AVDecoder plugin" failed
[pluginregistry] Opening 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf with "Still image input plugin" failed
gavf [read]: Non streaming mode
[plug] gavf_open_read failed
[pluginregistry] Opening 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf with "Gmerlin plug plugin" failed
Entity: line 1: parser error : Start tag expected, '<' not found
+4
^
[bggavl] Couldn't open file 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf
[pluginregistry] Opening 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf with "Parser for gmerlin EDLs" failed
[pluginregistry] Opening 2.8K LF 1:1 format (SUP 7.1)/S071C018_210930_FNIY.mxf with "Image video input plugin" failed
Segmentation fault

However, ffplay can play the video just fine.

Note this is not using the latest and greatest gmerlin/gmerlin-avdecoder/gavl from git, but those versions found in Debian (svn6298, with some FFmpeg5 patches applied).

umlaeute commented 1 year ago

Obviously Gmerlin chokes on the MXF container.

Converting the file to MOV, keeping the same codec (and dropping audio, just for the fun of it), tells me, that it cannot find a suitable video decoder:

$ ffmpeg -i S071C018_210930_FNIY.mxf -c:v copy -an S071C018_210930_FNIY.mov
[...]
$ gmerlin-play S071C018_210930_FNIY.mov 
no more csLADSPA plugins
Setting audio stream 0
Setting subtitle stream -1
[track] No video decoder found for fourcc ap4h (0x61703468)
[player] Opening location: S071C018_210930_FNIY.mov
[track] No video decoder found for fourcc ap4h (0x61703468)
[player.input] Track has neither audio nor video, skipping
[       0:00 ]/[       0:00 ]

(and there it hangs).

again ffplay can play back the file just fine.

bplaum commented 1 year ago

Thanks for the notice. I think fixed MXF and enabled the Prores decoder from ffmpeg. The bad news is, that I don't support the YUV Pixelformats with 10, 12 or 14 bits: I upshift everything to 16 bit. The good news is, that my OpenGL display driver handles 16 bit YUV directly.