0

Solution

ffmpeg -i input.mxf -pix_fmt yuv420p -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 192k -movflags +faststart test.mp4

Original Question

trying to convert a large MXF (well, large for its playtime 1.1GB, 2:36 minutes) into a reasonably small MP4 file to host on OneDrive (business). I can convert it with, for example:

ffmpeg -i input.mxf -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 192k output.mp4

And it does play in mediaplayers on my computer, but in OneDrive in Chrome I get the error message: "Sorry, there was a problem loading the video."

Now when I take a random MP4 testfile, convert it via the above command and upload it, it plays without issue.

Any ideas?

If you need something to investigate (terminal output, file info..), let me know.

Thanks!

Edit: Here's the log for:

ffmpeg -i input.mxf -pix_fmt yuv420p -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 192k -movflags +faststart test.mp4

Log:

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.0 (Solus)
  configuration: --prefix=/usr --libdir=/usr/lib64 --disable-debug --disable-stripping --enable-shared --disable-static --enable-avisynth --enable-avresample --enable-gcrypt --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libpulse --enable-libsnappy --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-nonfree --enable-nvdec --enable-nvenc --enable-openal --enable-opengl --enable-openssl --enable-sdl2 --enable-version3
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Guessed Channel Layout for Input Stream #0.5 : mono
Guessed Channel Layout for Input Stream #0.6 : mono
Guessed Channel Layout for Input Stream #0.7 : mono
Guessed Channel Layout for Input Stream #0.8 : mono
Input #0, mxf, from 'input.mxf':
  Metadata:
    product_uid     : 27b66489-cf4b-1ddd-ae1e-be3d000b0002
    uid             : 27b66489-cf4b-1ddd-ae1e-be3d000b0000
    generation_uid  : 27b66489-cf4b-1ddd-ae1e-be3d000b0001
    company_name    : NANO
    product_name    : MXF 
    product_version : 3.1.0.0
    modification_date: 2019-02-15T11:31:07.000000Z
    material_package_umid: 0x060A2B340101010501010D23130000007C7826A05B0C1845AB68D7D39C677BF8
    timecode        : 00:00:00:00
  Duration: 00:02:36.08, start: 0.000000, bitrate: 59982 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:3: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:4: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:5: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:6: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:7: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
    Stream #0:8: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x1ff1340] using SAR=1/1
[libx264 @ 0x1ff1340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x1ff1340] profile High, level 4.0
[libx264 @ 0x1ff1340] 264 - core 155 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    product_uid     : 27b66489-cf4b-1ddd-ae1e-be3d000b0002
    uid             : 27b66489-cf4b-1ddd-ae1e-be3d000b0000
    generation_uid  : 27b66489-cf4b-1ddd-ae1e-be3d000b0001
    company_name    : NANO
    product_name    : MXF 
    product_version : 3.1.0.0
    modification_date: 2019-02-15T11:31:07.000000Z
    material_package_umid: 0x060A2B340101010501010D23130000007C7826A05B0C1845AB68D7D39C677BF8
    timecode        : 00:00:00:00
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 0.04 fps, 12800 tbn, 25 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp (24 bit), 192 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D2313000000BF8B987DDF1F1749ABE27A7C953DC783
      encoder         : Lavc58.35.100 aac
[mp4 @ 0x1fe5480] Starting second pass: moving the moov atom to the beginning of the file.864x    
frame= 3902 fps= 21 q=-1.0 Lsize=   93645kB time=00:02:36.09 bitrate=4914.5kbits/s speed=0.858x    
video:89857kB audio:3670kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.126170%
[libx264 @ 0x1ff1340] frame I:18    Avg QP:19.65  size:174490
[libx264 @ 0x1ff1340] frame P:982   Avg QP:22.50  size: 43528
[libx264 @ 0x1ff1340] frame B:2902  Avg QP:24.02  size: 15895
[libx264 @ 0x1ff1340] consecutive B-frames:  0.7%  0.2%  0.2% 98.8%
[libx264 @ 0x1ff1340] mb I  I16..4: 11.7% 77.5% 10.7%
[libx264 @ 0x1ff1340] mb P  I16..4:  0.8%  6.4%  0.3%  P16..4: 40.4% 14.4%  9.4%  0.0%  0.0%    skip:28.4%
[libx264 @ 0x1ff1340] mb B  I16..4:  1.6% 10.4%  0.0%  B16..8: 16.4%  3.9%  0.1%  direct:14.4%  skip:53.0%  L0:45.2% L1:42.6% BI:12.2%
[libx264 @ 0x1ff1340] 8x8 transform intra:85.7% inter:79.2%
[libx264 @ 0x1ff1340] coded y,uvDC,uvAC intra: 60.2% 63.0% 3.7% inter: 17.6% 23.3% 0.1%
[libx264 @ 0x1ff1340] i16 v,h,dc,p: 30% 26% 29% 16%
[libx264 @ 0x1ff1340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 14% 46%  4%  3%  4%  3%  4%  4%
[libx264 @ 0x1ff1340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 23% 12%  6%  9%  9%  7%  6%  6%
[libx264 @ 0x1ff1340] i8c dc,h,v,p: 57% 20% 21%  2%
[libx264 @ 0x1ff1340] Weighted P-Frames: Y:0.1% UV:0.1%
[libx264 @ 0x1ff1340] ref P L0: 48.9% 51.1%
[libx264 @ 0x1ff1340] ref B L0: 70.1% 29.9%
[libx264 @ 0x1ff1340] ref B L1: 90.1%  9.9%
[libx264 @ 0x1ff1340] kb/s:4716.20
[aac @ 0x1feea40] Qavg: 173.287
5
  • No console log, so a guess: ffmpeg -i input.mxf -pix_fmt yuv420p -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 192k -movflags +faststart output.mp4
    – Gyan
    Feb 16 '19 at 5:02
  • Thank you! Alas, doesn't work. I'll update my question with the log from your command.
    – kraligor
    Feb 16 '19 at 11:32
  • In other browsers? Directly in Chrome?
    – Gyan
    Feb 16 '19 at 14:45
  • Okay, it's getting a bit weird now. I just tested again in Chrome > didn't work. Tested on the OneDrive app in Android > worked! Tested in Firefox on the computer > worked. Again tested in Chrome > worked! Soo.. maybe your command produced a working file after all, and I had some strange cache issues?
    – kraligor
    Feb 16 '19 at 16:12
  • Pretty sure your command did the trick, thank you. Post it again as answer and I'll mark it answered :)
    – kraligor
    Feb 16 '19 at 16:57
0

For widespread MP4 compatibility, video should be H264 with 4:2:0 subsampling, and audio should be AAC-LC. Additionally, moving the metadata to the front of the file is recommended for quick start of playback but isn't strictly necessary.

So,

ffmpeg -i input.mxf -pix_fmt yuv420p -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 192k -movflags +faststart output.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.