0

I'm working on adding .mlp audio / TrueHD w/ Atmos content into an .mkv container (certain playback programs require a video track to bitstream audio). I'm synthesizing a color background for the duration of the clip to serve as video track. Strangely, the command below worked for a time, but now I'm getting a clip that is 12 minutes and 2 seconds, 2 minutes longer than the audio file. The command is as follows:

ffmpeg -i test.mlp -f lavfi -i color=c=blue:s=640x480:r=15 -acodec copy -shortest output.mkv

ffprobe on the .mlp audio is as follows:

ffprobe version 2022-01-27-git-3c831847a8-full_build-www.gyan.dev Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --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-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --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-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      57. 19.100 / 57. 19.100
  libavcodec     59. 20.100 / 59. 20.100
  libavformat    59. 17.101 / 59. 17.101
  libavdevice    59.  5.100 / 59.  5.100
  libavfilter     8. 26.101 /  8. 26.101
  libswscale      6.  5.100 /  6.  5.100
  libswresample   4.  4.100 /  4.  4.100
  libpostproc    56.  4.100 / 56.  4.100
Input #0, truehd, from 'C:\[]\[]\[]\test.mlp':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)

any idea how to force a true "shortest" output? thanks!

1
  • Please include the output from your ffmpeg command, too.
    – MarianD
    Jan 30, 2022 at 11:06

1 Answer 1

0

From your ffprobe output:

Input #0, truehd, from 'C:\[]\[]\[]\test.mlp':
  Duration: N/A, start: 0.000000, bitrate: N/A

No duration, no bitrate in your .mlp file. MLP format (container) is raw, it doesn't contain metadata (as a duration and bitrate).

Moreover, -acodec copy in your ffmpeg command simply copies the mlp audio as a stream of bytes, obtaining no info beyond number of bytes.

So FFmpeg has hard time to estimate the duration of your audio

  • no direct info about duration,
  • no bitrate info for a fair estimation,
  • it has some info from your audio stream (as the sample rate and the bit depth),
  • it may know the size (in bytes) of your audio stream.

It means that the duration of your audio is guessed roughly enough, which results in such a difference (the -shortest option is based only on such an approximation).

One possibility how to fix it is using the -t option (for total time) instead of -shortest, for example

ffmpeg -i test.mlp -f lavfi -i color=c=blue:s=640x480:r=15 -acodec copy -t "10:02" output.mkv

(you may use apostrophes instead of quotes – it depends on your operating system, or simply express the time in seconds: -t 602).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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