When playing QuickTime (.mov) files with AVC-Intra 50/100 Mbps video, when the frames have no SPS-PPS header (so not in any frame at all), there is no playback of the video in VLC 2.2.1 Mac. When there is a SPS-PPS header in either the first or all frames, the playback is Ok.
When playing MXF OP1a files with AVC-Intra 50 Mbps video, when the frames have no SPS-PPS header (so not in any frame at all), there is distorted (green slices) playback of the video in VLC 2.2.1 Mac. For either AVC-Intra 100 Mbps or when there is a SPS-PPS header in either the first or all frames, the playback is Ok.
I believe in VLC a matching (generated) SPS-PPS parameter set block needs to be fed to the decoder first before playback will be Ok for above cases. Couldn't find any other related ticket in trac.
Sample fileset is uploaded (didn't want to attach 124 MB to this ticket) to http://ge.tt/7DYellQ2. So 3 out of those 12 files don't playback video in VLC.
Rumours from some people on other side of the globe also attempting to playback with VLC Windows, is that at least a MXF AVC-Intra 50 Mbps file without SPS-PPS headers will playback in older versions (not clear which exactly) of VLC, but fail in Windows VLC 2.2.1, will try to chase...
Background:
There seems a need/preference for workflows without SPS-PPS headers in AVC-Intra when used with Avid Media Composer, which has a bug and can corrupt the essence if the headers are present.
These QuickTime and MXF files are created with own re-wrapper tools for MXF/QuickTime and believed to be broadcast compliant and playback Ok in MXF4mac Player, Adobe Premiere, FCP-7/X and Avid Media Composer.
As there are only a handful of different broadcast HD AVC-Intra formats: For QuickTime, the relevant SPS-PPS could be derived from lookup in fixed set of SPS-PPS blocks using Codec ID in Image Descriptor and/or frame sizes. For MXF, from Header Metadata and/or frame sizes. Extra low-level details available if needed...
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
Hello Jean-Baptiste and François. Thanks for your usual quick responses.
Obviously the AVC(-Intra) stream before going into a decoder needs at least one SPS-PPS set.
But the situation lies a bit more complicated. For broadcast AVC-Intra (HD) it started somewhere around 2008 or so with Panasonic P2 AVC-Intra MXF OPAtom OP1b files with SPS-PPS only in first frame.
Then we got QuickTime files (Apple, Panasonic, ...) with various Codec ID's including a generic (Panasonic) 'AVCI' and specific ones for each AVC-Intra format (Apple) 'ai1x' and 'ai5x'. QuickTime .mov using these Codec ID's are strongly related/overlapping with ISO/IEC 14496-15, in which there is provision for a 'avcC' AVC Configuration atom, which extends the Image Description atom in the 'moov' (metadata, not samples). The samples itself may or may not contain SPS-PPS (see next paragraph).
Begin 2013 we asked Panasonic Japan (at that time leading in broadcast AVC-Intra) for their recommendations and they advised, that MXF OPAtom should have only 'first' frame (their P2 standard), MXF OP1a 'all' frames and QuickTime 'no' frames (following Apple FCP implementation). They noted however that some large vendors (amongst them Omneon/Harmonic) changed from 'all' to 'no' frames for MXF OP1a (perhaps because of the Avid bug ?).
Later for MXF came SMPTE ST 381-3-2013 which gives the option for SPS/PPS Flag in the MXF AVC Sub Descriptor, either: Unknown/NoSpecific Location, First Access Unit, Every Access Unit or Periodically placed for each GOP.
Somewhere in the middle of this (around 2012-2013) our company needed to deliver workflows including AVC-Intra QuickTime and MXF files, and some customers were using Avid Media Composer. As mentioned we discovered a bug in Media Composer that (invisible) might corrupt frames at the end. So we needed to decide to wait for some fix from Avid or see if 'no' frames in QuickTime and MXF was 'inside the spec'.
After careful considerations taking into account specifications, the conversations with Panasonic, testing and the industry trend (what other companies would read/write) we decided to make our (FORK) software flexible, such that at each point in Ingest/Import/Archive/Edit/Rewrap/Playout/Export it is configurable to use either no/first/all frames for either QuickTime/MXF. As mentioned we still believe all combinations are 'within' (QT/MXF wrapper) specifications and are read-write supported on most players (QT Player, MXF4mac, ...), editors (Premiere, FCP, Avid, ...) and SDK's (BMX, OpenCube, ...).
For some customers facing essence corruption in combination with Avid and having tested the workflow chain we (our company and the customer) choose to go for no-frames MXF files, which has been running successfully for the past few years. So if you want, you may blame me (amongst a group of others) for being that 'genius' ;-)
All this is for AVC-Intra 50/100 HD 720/1080 only, I've seen the newer Sony/Panasonic/Canon/... specifications for 2K/4K incl. Long GOP and the tendency seems to be to more include/keep the SPS-PPS sets inside the essence (Long GOP being a difficult case). But for the 'older' AVC-Intra 50/100 Mbps some SPS-PPS re-creation (from codec ID's, frame sizes and/or other header metadata) might be needed to playback 'no frame' QuickTime/MXF variants. Looking at François's ffmpeg link it already is being done in some cases...
We happened to attempt playback in VLC of some files in mentioned workflows and raised this ticket to make VLC support the broadest number of formats. Will be happy to support (check/advise/add code) any development as needed...
Thanks and keep up the good work, it is appreciated !
We happened to attempt playback in VLC of some files in mentioned workflows and raised this ticket to make VLC support the broadest number of formats. Will be happy to support (check/advise/add code) any development as needed...
Yeah, don't worry... It's just the usual insane decisions.
What's weird is that technically, we should already support those "things".
Could you, by any chance, try the latest ZIP version of VLC 3.0.0 win32 on our nightly builds servers and test?
Just tried both nightly win32/vlc-3.0.0-20151027-0002 and win64/vlc-3.0.0-20151027-0402 with all 12 test files and basically same result as VLC 2.2.1: all files playback Ok, apart from these 'no-frame' SPS-PPS files:
QuickTime AVC-Intra 50/100 either crashes VLC 3.0.0 or gives no image
MXF AVC-Intra 50 gives distorted picture
François: extradata needs to be passed a rebuilt AnnexB sps/pps, like ffmpeg does.
...the strange thing is that MXF AVC-Intra 100 'no-frame' does playback in both VLC 2.2.1 and 3.0.0. I reconfirmed with H264 parser that there is really no SPS-PPS present in that file. Maybe just the default codec setup just happened to match the file (100 Mbps, 1080i50)
I understand that VLC is currently not using the ffmpeg ff_generate_avci_extradata() function, but own code (likely without any static tables) ?
For what it is worth:
In contrast with ffmpeg, you will actually need 20 (not 4) different static SPS tables and (only) 3 different PPS tables. These 20 are there for: 50/100 Mbps, 1080i/1080p/720p and also framerate 24/25/30/50/60 (ffmpeg doesn't take latter into account).
The correct table entry index to be used as said can be taken either from QuickTime/MXF metadata (width/height, QT 'fiel' if available, QT codec ID if not generic 'AVCI', ...) but in general (when insufficient info from metadata) will also need to check the framesize for being either a known fixed framesize with/without 512 SPS-PPS bytes.
Need to check if SPS-PPS is already present (by frame size or NAL parsing) and if SPS-PPS is added, will need to adjust AUD to assure the decoder will see exactly one Access Unit (sample): if AUD is present it needs to be changed to Filler and added SPS-PPS must start with AUD.
We received those 20+3 static tables from Panasonic Japan, I might reach out to them if I may pass them on to VLC (and hence make them public). I would judge it would be beneficial for them as well to have playback of all AVC-Intra files. Obviously only useful if this ticket would be progressed, please advise...
(so the MXF version) will identically fail (showing distorted decoded images) with:
[h264 @ 0x102807000] out of range intra chroma pred mode at 0 0[h264 @ 0x102807000] error while decoding MB 0 0[h264 @ 0x102807000] negative number of zero coeffs at 66 4[h264 @ 0x102807000] error while decoding MB 66 4[h264 @ 0x102807000] top block unavailable for requested intra mode at 12 10[h264 @ 0x102807000] error while decoding MB 12 10[h264 @ 0x102807000] top block unavailable for requested intra mode at 78 14[h264 @ 0x102807000] error while decoding MB 78 14...
Sorry, for some reason 7 out of 12 sample files where not uploaded correctly, ge.tt doesn't seem to like them... I have just updated the complete set on http://ge.tt/7DYellQ2, it took another 3 attempts to upload them all. Obviously for AvcIntra50NoFrames.mxf you should use 'Train (AVC-Intra, 50 Mbps, No Frames SPS-PPS Header).mxf'.
for AvcIntra50NoFrames.mxf you should use 'Train (AVC-Intra, 50 Mbps, No Frames SPS-PPS Header).mxf'.
I created FFmpeg ticket 5029, thank you for the sample!
This would be easy to fix by forcing a width of 1440 in the demuxer but unfortunately, I don't see how the demuxer can distinguish between AVCI50 and AVCI100 (that needs width 1920) for the files you provided.
Which static PPS (out of 3 different) and SPS (out of 20 different) preset to use depends on 50 or 100 Mbps, format 720p/1080i/p and framerate 24/25/29.97/50/59.94. For the 'No Frames SPS-PPS Header' file variants these need to be derived from the MXF Header Metadata (Picture Descriptor & Track EditRate) or QuickTime 'moov' atom data (Image Description & Media/Track Timescale) and/or frame size in bytes (but some variants have equal framesize)... Not sure if all that info is available at the demuxer (if that is where the SPS/PPS will be added) in some form ?
Which static PPS (out of 3 different) and SPS (out of 20 different) preset to use
So far the six sets present in libavformat/utils.c are sufficient for all samples we have (including the one that currently doesn't work), if you have a sample that needs another set, please upload;-)
depends on 50 or 100 Mbps
I don't think the bitrate information is present in the mxf file (or if it is I don't know where to search).
format 720p/1080i/p
Of course, the issue is that a wrong resolution is written in the file header / the same resolution as for a file that needs another SPS/PPS.
and framerate 24/25/29.97/50/59.94.
That information may be present (I didn't look) but I wonder if it would really be helpful?
For the 'No Frames SPS-PPS Header' file variants these need to be derived from the MXF Header Metadata (Picture Descriptor & Track EditRate)
I have a stash about that issue, that
should builds sps/pps parameters instead of blindly applying arbitrary ones.
Unfortunately, the ffmpeg ones make use of some unknown (reserved) fields according to my outdated spec.
I have requested to Panasonic Japan if we can use the static SPS/PPS tables that we have once received from them for VLC/ffmpeg open source. If the answer is positive, I think it is easier to discuss the issue. Stay tuned...
I have requested to Panasonic Japan if we can use the static SPS/PPS tables that we have once received from them for VLC/ffmpeg open source.
If the answer is positive, I think it is easier to discuss the issue. Stay tuned...
How would that help?
We have the necessary SPS/PPS but we don't know how to decide when to use it. If you see the difference between the AVCI50 and AVCI100 mxf "No frames" files, I can probably (quickly) fix the issue.
How would that help?
I thought that if we have all 20 SPS variants listed (I saw less in ffmpeg), then it would be easier to see what would be needed in terms of metadata to get it right in all cases...
If you see the difference between the AVCI50 and AVCI100 mxf "No frames" files, I can probably (quickly) fix the issue.
I see 2 differences:
The MPEG Video Descriptor has a field 'Video Coding Scheme ID' (a 16 byte Universal Label) that is different, in fact it covers most variants:
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.20.01 H.264/MPEG-4 AVC High 10 Intra Unconstrained Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.01 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 1080/59.94i Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.02 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 1080/50i Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.03 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 1080/29.97p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.04 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 1080/25p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.08 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 720/59.94p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.21.09 H.264/MPEG-4 AVC High 10 Intra RP2027 Constrained Class 50 720/50p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.01 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 1080/59.94i Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.02 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 1080/50i Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.03 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 1080/29.97p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.04 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 1080/25p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.08 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 720/59.94p Coding
06.0E.2B.34.04.01.01.0A-04.01.02.02.01.32.31.09 H.264/MPEG-4 AVC High 422 Intra RP2027 Constrained Class 100 720/50p Coding
The (fixed) frame sizes are different for most of the 20 variants, like (sizes without 512 bytes SPS-PPS at the front):
AVC-Intra 100 Mbps, 1080i60: 472064 bytes
AVC-Intra 100 Mbps, 1080i50: 568320 bytes
AVC-Intra 50 Mbps, 1080i60: 232448 bytes
AVC-Intra 50 Mbps, 1080i50: 280576 bytes
...
I'm not sure if either or both of above information is available at the place you need it ?
How would that help?
I thought that if we have all 20 SPS variants listed (I saw less in ffmpeg), then it would be easier to see what would be needed in terms of metadata to get it right in all cases...
As said, if you have a sample for which there is no working SPS/PPS set in FFmpeg, please provide it: For the failing AVCI50 Train sample, the issue was just how to choose the correct set without breaking the matching AVCI100 (Sport) sample.
If you see the difference between the AVCI50 and AVCI100 mxf "No frames" files, I can probably (quickly) fix the issue.
I see 2 differences:
The MPEG Video Descriptor has a field 'Video Coding Scheme ID' (a 16 byte Universal Label) that is different, in fact it covers most variants:
It does seem that passing only AnnexB extradata or a derived avcC to avcodec is not sufficient as it only decodes one picture, then other are broken.
Repeating the SPS/PPS before picture is no help either.
[h264 @ 0x7f8c94c5b560] top block unavailable for requested intra4x4 mode -1 at 96 6[h264 @ 0x7f8c94c5b560] error while decoding MB 96 6[h264 @ 0x7f8c94c5b560] out of range intra chroma pred mode at 24 10[h264 @ 0x7f8c94c5b560] error while decoding MB 24 10[h264 @ 0x7f8c94c5b560] out of range intra chroma pred mode at 74 13[h264 @ 0x7f8c94c5b560] error while decoding MB 74 13[h264 @ 0x7f8c94c5b560] top block unavailable for requested intra4x4 mode -1 at 0 17[h264 @ 0x7f8c94c5b560] error while decoding MB 0 17[h264 @ 0x7f8c94c5b560] negative number of zero coeffs at 49 20[h264 @ 0x7f8c94c5b560] error while decoding MB 49 20[h264 @ 0x7f8c94c5b560] top block unavailable for requested intra4x4 mode -1 at 96 23[h264 @ 0x7f8c94c5b560] error while decoding MB 96 23[h264 @ 0x7f8c94c5b560] negative number of zero coeffs at 25 27[h264 @ 0x7f8c94c5b560] error while decoding MB 25 27[h264 @ 0x7f8c94c5b560] top block unavailable for requested intra4x4 mode -1 at 72 30[h264 @ 0x7f8c94c5b560] error while decoding MB 72 30