ffmpeg: video parameters incompatible with DNxHD

1.7k Views Asked by At

I'm trying to convert mp4 to mov, however ffmpeg is having issues with the video conversion:

  Stream #0:0 -> #0:0 (h264 (native) -> dnxhd (native))

I've tried several of suggested configuration without success:

  • -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p10 -r 24000/1001 -b:v 175M
  • -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p10 -r 25/1 -b:v 185M
  • -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p10 -r 60000/1001 -b:v 440M
  • -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 24000/1001 -b:v 115M
  • -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 25/1 -b:v 120M

Any idea what's wrong? How do I choose "correct" video format?

Is it possible that ffmpeg refuses to convert video when camera is rotated 90°? i.e. the input resolution would be 1080x1920?

ffmpeg -i google-2020/VID-20200421-WA0000.mp4 -map_metadata 0 -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p10 -r 24000/1001 -b:v 175M google-2020-conv2/VID-20200421-WA0000.mov
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'google-2020/VID-20200421-WA0000.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2020-04-26T12:06:16.000000Z
  Duration: 00:00:12.98, start: 0.000000, bitrate: 720 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 640x352 [SAR 1:1 DAR 20:11], 592 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2020-04-26T12:06:16.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 04/26/2020.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-04-26T12:06:16.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 04/26/2020.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> dnxhd (native))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[dnxhd @ 0x55b24eeae0a0] video parameters incompatible with DNxHD. Valid DNxHD profiles:
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 175Mbps; pixel format: yuv422p10; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 185Mbps; pixel format: yuv422p10; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 365Mbps; pixel format: yuv422p10; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv422p10; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 115Mbps; pixel format: yuv422p; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 120Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 145Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 240Mbps; pixel format: yuv422p; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 290Mbps; pixel format: yuv422p; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 175Mbps; pixel format: yuv422p; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 185Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 220Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 365Mbps; pixel format: yuv422p; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv422p; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 185Mbps; pixel format: yuv422p10; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 220Mbps; pixel format: yuv422p10; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 120Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 145Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 185Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080i; bitrate: 220Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 120Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 145Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p10; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p10; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 180Mbps; pixel format: yuv422p10; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 220Mbps; pixel format: yuv422p10; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 90Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 110Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 180Mbps; pixel format: yuv422p; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 220Mbps; pixel format: yuv422p; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 60Mbps; pixel format: yuv422p; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 60Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 75Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 120Mbps; pixel format: yuv422p; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1280x720p; bitrate: 145Mbps; pixel format: yuv422p; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 36Mbps; pixel format: yuv422p; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 36Mbps; pixel format: yuv422p; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 45Mbps; pixel format: yuv422p; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 75Mbps; pixel format: yuv422p; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 90Mbps; pixel format: yuv422p; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 350Mbps; pixel format: yuv422p10; framerate: 24000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 390Mbps; pixel format: yuv422p10; framerate: 25/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 440Mbps; pixel format: yuv422p10; framerate: 30000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 730Mbps; pixel format: yuv422p10; framerate: 50/1
[dnxhd @ 0x55b24eeae0a0] Frame size: 1920x1080p; bitrate: 880Mbps; pixel format: yuv422p10; framerate: 60000/1001
[dnxhd @ 0x55b24eeae0a0] Frame size: 960x720p; bitrate: 42Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 960x720p; bitrate: 60Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 960x720p; bitrate: 75Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 960x720p; bitrate: 115Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080p; bitrate: 63Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080p; bitrate: 84Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080p; bitrate: 100Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080p; bitrate: 110Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 80Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 90Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 100Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24eeae0a0] Frame size: 1440x1080i; bitrate: 110Mbps; pixel format: yuv422p; framerate: 0/0
[dnxhd @ 0x55b24ea11a60] ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

2

There are 2 best solutions below

2
On

I found a working configuration (not of those suggested by ffmpeg). Changing pixel format and adding -profile:v dnxhr_444 i.e. DNxHR 444 - Finishing Quality (12-bit 4:4:4) (Cinema-quality delivery) helps

-vcodec dnxhd -pix_fmt gbrp10le -profile:v dnxhr_444 -r 30000/1001 -b:v 440M
1
On

Any idea what's wrong? How do I choose "correct" video format?

DNxHD has specific requirements. You must choose a correct:

  • width x height
  • bitrate
  • pixel format
  • frame rate

Your command is missing an accepted width x height. Your input is 640x352, but DNxHD requires 720p or bigger. Refer to Valid DNxHD profiles in the ffmpeg output in your question.

With an input of 640x352 I wonder if DNxHD is the right choice. Why do you need DNxHD? Might be an XY problem.

Is it possible that ffmpeg refuses to convert video when camera is rotated 90°? i.e. the input resolution would be 1080x1920?

I see no rotation metadata/sidedata in your file info. ffmpeg will auto-rotate when encoding unless you tell it not to with -noautorotate.

If it rotated to 1080x1920, then it would be invalid as it is not explicitly listed in Valid DNxHD profiles in the ffmpeg output in your question.

Example

Closest accepted profile matching your input is:

Frame size: 1280x720p; bitrate: 110Mbps; pixel format: yuv422p; framerate: 30000/1001

Command:

ffmpeg -i input.mp4 -vf "fps=30000/1001,scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720,setsar=1,format=yuv422p" -c:v dnxhd -b:v 110M -c:a pcm_s16le output.mov

The scale and pad filter examples are from Resizing videos with ffmpeg to fit into specific size. Refer to this link for more examples if you prefer to pad-to-fit (letterbox/pillarbox) instead of crop-to-fit.