Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't process MXF file / interval (-2305843009213s) is way to small / New Windows binaries #44

Closed
pyahmed opened this issue Oct 19, 2023 · 3 comments

Comments

@pyahmed
Copy link

pyahmed commented Oct 19, 2023

mt version: 1.0.11
OS: Windows 10 Pro

I have some MXF files which can't be processed with mt (version 1.0.11 on Windows).

cmd:
mt.exe sample_short.mxf

output:

time="2023-10-19T10:18:48+02:00" level=info msg="using font: DroidSans.ttf"
time="2023-10-19T10:18:48+02:00" level=info msg="generating contact sheet for sample_short.mxf"
time="2023-10-19T10:18:49+02:00" level=warning msg="very small timestamps in use... consider decreasing numcaps"
time="2023-10-19T10:18:49+02:00" level=error msg="interval (-2305843009213s) is way to small (less then 9s), please decrease numcaps"
time="2023-10-19T10:18:49+02:00" level=fatal msg="Can't generate screenshot: can't seek to timestamp"

It doesn't matter if I specify interval, apparently the libav/ffmpeg version used has a problem dealing with the mxf file. If I remux with ffmpeg to mxf, mt works fine with.
ffmpeg -i sample_short.mxf -c copy -map 0 sample_short_remuxed.mxf

cmd:
mt.exe sample_short_remuxed.mxf
output:

time="2023-10-19T10:19:15+02:00" level=info msg="using font: DroidSans.ttf"
time="2023-10-19T10:19:15+02:00" level=info msg="generating contact sheet for sample_short_remuxed.mxf"
time="2023-10-19T10:19:15+02:00" level=warning msg="very small timestamps in use... consider decreasing numcaps"
time="2023-10-19T10:19:15+02:00" level=error msg="interval (4s) is way to small (less then 9s), please decrease numcaps"
time="2023-10-19T10:19:15+02:00" level=info msg="generating screenshot 01/04 at 00:00:04"
time="2023-10-19T10:19:15+02:00" level=info msg="generating screenshot 02/04 at 00:00:08"
time="2023-10-19T10:19:15+02:00" level=info msg="generating screenshot 03/04 at 00:00:12"
time="2023-10-19T10:19:15+02:00" level=info msg="generating screenshot 04/04 at 00:00:16"
time="2023-10-19T10:19:15+02:00" level=info msg="Composing Contact Sheet"
time="2023-10-19T10:19:15+02:00" level=info msg="appending header informations"
time="2023-10-19T10:19:15+02:00" level=info msg="Saved image to sample_short_remuxed.jpg"

For practical reasons I can't remux the files (usually around 100-200 GB). I've tested the same files on a temporary Linux system with the latest version of mt (1.0.13) and they work just fine, no remuxing needed. Would it be possible to Windows binaries of the latest version? Or is there some (detailed) guide on how to generate binaries for Windows?

@mutschler
Copy link
Owner

Strange, can you run ffprobe on your video and check what kind of video stream it contains?

ffprobe:

Input #0, mxf, from 'freeMXF-mxf1.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010100
    modification_date: 2006-01-11T18:58:47.524000Z
    uid             : 1eff163b-65f8-4242-83a7-81fa7d505107
    company_name    : freeMXF.org
    product_name    : mxfwrap file wrapper
    product_version : Based on MXFLib 0.5.3(5)-Development
    toolkit_version_num: 0.5.3.5.2
    product_uid     : 846614f3-278d-d341-86dc-f089adefd053
    generation_uid  : fe8a136e-a850-c144-850d-5d95cbb7b507
    material_package_umid: 0x060A2B340101010501010D201300000062DDDE55B4AA81408069E779AF517561
    material_package_name: A Material Package
    timecode        : 00:00:00:00
  Duration: 00:00:10.64, start: 0.000000, bitrate: 2116 kb/s
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt470bg, progressive), 720x576 [SAR 16:15 DAR 4:3], 2097 kb/s, 25 fps, 25 tbr, 25 tbn
    Metadata:
      file_package_umid: 0x060A2B34010101010101012013000000B1E3714C9D9C354CBF62ECD54FBA1241
      file_package_name: File Package: SMPTE 381M frame wrapping of MPEG2 video elementary stream
      track_name      : Picture Track
    Side data:
      cpb: bitrate max/min/avg: 2097200/0/0 buffer size: 1835008 vbv_delay: N/A

I've successfully tested:

mt Version 1.0.11
with a test file from http://www.freemxf.org/samples/freeMXF-mxf1.mxf
mt config:

{
    "numcaps": 16,
    "columns": 4,
    "padding": 0,
    "width": 400,
    "font_all": "DroidSans.ttf",
    "font_size": 12,
    "disable_timestamps": true,
    "verbose": false,
    "single_images": false,
    "bg_header": "0,0,0",
    "fg_header": "255,255,255",
    "bg_content": "0,0,0",
    "header_image": "",
    "skip_blank": false,
    "header": true,
    "header_meta": true,
    "filter": "none",
    "filename": "{{.Path}}{{.Name}}.jpg",
    "from": "00:00:00",
    "to": "00:00:00",
    "skip_existing": false,
    "overwrite": false,
    "sfw": false,
    "watermark": "",
    "fast": true,
    "watermark_all": "",
    "comment": "",
    "skip_blurry": false,
    "blur_threshold": 62,
    "blank_threshold": 85,
    "webvtt": false,
    "upload": false,
    "upload_url": "http://example.com/upload"
}

produced the following output
freeMXF-mxf1

Maybe you could try the sample file as well?

might be a unsupported codec inside the container or something like that. Sadly my server i used to create Windows builds on did die a while ago and i didn't find the time to set up a new one.

If installing a wsl subsystem is an option you could try that (most likely easier than compiling from source) but you should be able to compile it from source on windows as well given that you'll have a gcc compiler available. I cant tell you anymore than that since i don't have a windows system myself.

Basically what you'll want to do is:

  • download ffmpeg and compile it
  • build mt and point it to the ffmpeg lib compiled before

@pyahmed
Copy link
Author

pyahmed commented Oct 20, 2023

Your linked sample file works. The mxf files I'm talking about work after passing them through ffmpeg or using the latest mt version (on Linux).
Anyway here is the ffprobe output:

ffprobe version 2023-10-18-git-e7a6bba51a-full_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 27.100 / 58. 27.100
  libavcodec     60. 30.102 / 60. 30.102
  libavformat    60. 15.100 / 60. 15.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mxf, from 'sample_short.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    toolkit_version_num: 5.0.15.0.1
    uid             : ad149eb1-6dd7-11ee-8087-b48351076ba4
    generation_uid  : ad149eb2-6dd7-11ee-a571-b48351076ba4
    company_name    : MOG Technologies
    product_name    : mxfSPEEDRAIL
    product_version_num: 2023.7.0.0.0
    product_version : MXF SDK 5.0.15.0.1
    application_platform: win32
    product_uid     : 8f28a42c-fef5-4204-8400-c3fcc9eec91d
    modification_date: 2023-10-18T16:59:18.424000Z
    material_package_umid: 0x060A2B340101010501010D13130000001D34A503350206A57160B48351076BA4
    timecode        : 18:59:11:23
  Duration: 00:00:16.88, start: 0.000000, bitrate: 123416 kb/s
  Stream #0:0: Video: h264 (High 4:2:2 Intra), yuv422p10le(pc, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D1213FAC3B71C34A503350206A5ED4FB48351076BA4
      file_package_name: Source Package
      track_name      : Track 1
  Stream #0:1: Audio: pcm_s24le, 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D1213FAC3B71C34A503350206A5ED4FB48351076BA4
      file_package_name: Source Package
      track_name      : Track 2
  Stream #0:2: Data: none
    Metadata:
      file_package_umid: 0x060A2B340101010501010D1213FAC3B71C34A503350206A5ED4FB48351076BA4
      file_package_name: Source Package
      track_name      : Track 3
      data_type       : vbi_vanc_smpte_436M
Unsupported codec with id 0 for input stream 2

I ended up building ffmpeg and subsequently mt from source and thanks to https://github.com/m-ab-s/media-autobuild_suite it wasn't actually that hard... took a couple of tries but it worked out. I needed to remove libopenh264 as mt complained about missing dll file, so dll file needed to be next to it. After compiling ffmpeg without and rebuilding mt, it worked fine.

For anyone wishing to build a windows binary

  • build ffmpeg with the media-autobuild_suite (link above)
  • static + shared
  • do not enable libjpegxl
  • do not enable libopenh264
  • make to sure to comment those lines in ffmpeg_options.txt

Once ffmpeg build is completed successfully, download and unpack mt, open a MinGW shell (MinTTY shortcut in media-autobuild_suite folder), and change to the above unpacked folder. Proceed as in mt docs:

export LD_LIBRARY_PATH=/path/to/ffmpeg/lib/ 
export PKG_CONFIG_PATH=/path/to//ffmpeg/lib/pkgconfig/
go build

If your ffmpeg compilation folder was C:\ffmpeg_compiling, then lib would be C:\ffmpeg_compiling\local64\lib and pkgconfig under C:\ffmpeg_compiling\local64\lib\pkgconfig.

mt.ext should be built after some time :-)

@mutschler
Copy link
Owner

glad you got it working and thanks for sharing the build steps for windows :)

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

No branches or pull requests

2 participants