Skip to content

MXF: Fix OP47 Teletext not being probed as a Text track for short-duration files. - #2671

Merged
JeromeMartinez merged 1 commit into
MediaArea:masterfrom
MaxEliaserAWS:bugfix/op47_teletext_in_mxf_not_probed_for_short_files
Sep 24, 2026
Merged

JeromeMartinez merged 1 commit into
MediaArea:masterfrom
MaxEliaserAWS:bugfix/op47_teletext_in_mxf_not_probed_for_short_files

Conversation

@MaxEliaserAWS

@MaxEliaserAWS MaxEliaserAWS commented Aug 27, 2026 •

Copy link
Copy Markdown

This fixes a regression from commit 6e03ccb. Prior to this commit, MXF would do a supplemental probe of 64 MiB at the midpoint of the file to identify captions. After this commit, the supplemental probe's start-point and window-size were made configurable, defaulting to a start-point of 50% by byte- offset and a window size of 30 seconds (extrapolated from average bitrate.)

However, for very short files, there may not be 30 more seconds of content after the midpoint of the file. This commit handles that scenario by clamping the size of the probe window so it fits in the file, rather than skipping the probe altogether.

Symptom of the regression is that, for short duration MXF files containing OP47 Teletext, the "Text" track goes missing from the output after commit 6e03ccb. (Sometimes I have seen it still reported as an "Other" track, which I still consider regressed behavior; other times it's completely gone.)

I have created this test file to reproduce the bug; you are free to keep it and use it for regression testing or any other purpose.
op47_teletext_regression_for_mediainfo.mxf.gz
Bad output (note, the Text track is missing)

~$ mediainfo /tmp/op47_teletext_regression_for_mediainfo.mxf 
General
Complete name                            : /tmp/op47_teletext_regression_for_mediainfo.mxf
Format                                   : MXF
Commercial name                          : AVC-Intra 100
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 407 MiB
Duration                                 : 30 s 30 ms
Overall bit rate                         : 114 Mb/s
Frame rate                               : 29.970 FPS
Encoded date                             : 2026-08-27 01:54:45.188
Writing application                      : Elemental Server 2.18.0.0.1
Writing library                          : libMXF (Linux 64-bit) 1.1.0.0.0

Video
ID                                       : 1001
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Commercial name                          : AVC-Intra 100
Format profile                           : High 4:2:2 Intra@L4.1
Format settings, CABAC                   : No
Format settings, GOP                     : N=1
Format settings, wrapping mode           : Frame
Format settings, Slice count             : 10 slices per frame
Codec ID                                 : 0D01030102106001-0401020201323103
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 114 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 1.829
Stream size                              : 407 MiB
Title                                    : V1
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Other #1
ID                                       : 901-Material
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 00:00:00;00
Time code of last frame                  : 00:00:29;29
Time code settings                       : Material Package
Time code, stripped                      : Yes
Title                                    : TC1

Other #2
ID                                       : 901-Source
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 00:00:00;00
Time code of last frame                  : 00:00:29;29
Time code settings                       : Source Package
Time code, stripped                      : Yes
Title                                    : TC1

Good output (note, the Text track is now present)

~$ mediainfo /tmp/op47_teletext_regression_for_mediainfo.mxf 
General
Complete name                            : /tmp/op47_teletext_regression_for_mediainfo.mxf
Format                                   : MXF
Commercial name                          : AVC-Intra 100
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 407 MiB
Duration                                 : 30 s 30 ms
Overall bit rate                         : 114 Mb/s
Frame rate                               : 29.970 FPS
Encoded date                             : 2026-08-27 01:54:45.188
Writing application                      : Elemental Server 2.18.0.0.1
Writing library                          : libMXF (Linux 64-bit) 1.1.0.0.0

Video
ID                                       : 1001
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Commercial name                          : AVC-Intra 100
Format profile                           : High 4:2:2 Intra@L4.1
Format settings, CABAC                   : No
Format settings, GOP                     : N=1
Format settings, wrapping mode           : Frame
Format settings, Slice count             : 10 slices per frame
Codec ID                                 : 0D01030102106001-0401020201323103
Duration                                 : 30 s 30 ms
Bit rate mode                            : Constant
Bit rate                                 : 114 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 1.829
Stream size                              : 407 MiB
Title                                    : V1
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Text
ID                                       : 3001-888
Format                                   : Teletext Subtitle
Format settings, wrapping mode           : Frame
Muxing mode                              : Ancillary data / OP-47 / SDP
Codec ID                                 : 0D010301020E0000
Duration                                 : 30 s 30 ms
Frame rate                               : 29.970 FPS
Title                                    : D1

Other #1
ID                                       : 901-Material
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 00:00:00;00
Time code of last frame                  : 00:00:29;29
Time code settings                       : Material Package
Time code, stripped                      : Yes
Title                                    : TC1

Other #2
ID                                       : 901-Source
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 00:00:00;00
Time code of last frame                  : 00:00:29;29
Time code settings                       : Source Package
Time code, stripped                      : Yes
Title                                    : TC1

…ation files.

This fixes a regression from commit 6e03ccb. Prior to this commit,
MXF would do a supplemental probe of 64 MiB at the midpoint of the file to
identify captions. After this commit, the supplemental probe's start-point and
window-size were made configurable, defaulting to a start-point of 50% by byte-
offset and a window size of 30 seconds (extrapolated from average bitrate.)

However, for very short files, there may not _be_ 30 more seconds of content
after the midpoint of the file. This commit handles that scenario by clamping
the size of the probe window so it fits in the file, rather than skipping the
probe altogether.
@JeromeMartinez

Copy link
Copy Markdown
Member

Thank you for the report and PR.
Regression tests shows issues which seem not related to this PR but this PR triggers hidden bugs, I need to check a bit more, next week.
Additionally, I am wondering if it wouldn't make more sense to avoid the seek completely with short content, we could actually avoid the seek to footer then back to the middle of the file, if the file meet the criteria in your PR, I'll also check that next week.

@JeromeMartinez JeromeMartinez self-assigned this Aug 28, 2026
@MaxEliaserAWS

Copy link
Copy Markdown
Author

Thanks for the update.

Was there a test suite I should have run prior to putting up my PR? I saw some directories that looked related to testing, but I did not see frequent/recent commit activity there, and nothing that looked like testing against a library of media files. But, I did not look that close.

@JeromeMartinez

Copy link
Copy Markdown
Member

Was there a test suite I should have run prior to putting up my PR?

Unfortunately the suite is not public.
At some point we need to have a public test suite with the files we can share publicly, but most MXF files we have can not be shared :(.

@MaxEliaserAWS

Copy link
Copy Markdown
Author

I figured. well, you can share the one I included with the PR :)

@JeromeMartinez

Copy link
Copy Markdown
Member

I figured. well, you can share the one I included with the PR :)

And I appreciate that, OP47 files are rare.

@MaxEliaserAWS

Copy link
Copy Markdown
Author

I'll just plug the product I work on then, AWS Elemental MediaConvert, which semi-recently added a Teletext encoder and can now convert most text-based caption types to Teletext, and will use the OP47 format when you add a Teletext track to an MXF output.
https://docs.aws.amazon.com/mediaconvert/latest/ug/teletext-output-captions.html

@JeromeMartinez
JeromeMartinez merged commit fd5461a into MediaArea:master Sep 24, 2026
20 checks passed
JeromeMartinez added a commit that referenced this pull request Sep 24, 2026
…_mxf

MXF: Fix premature Fill of ANC essence causing Teletext loss when content is sparse (different from #2671)
@MaxEliaserAWS
MaxEliaserAWS deleted the bugfix/op47_teletext_in_mxf_not_probed_for_short_files branch September 24, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants