Answers.Body: <p>From your <code>ffprobe</code> output:</p>
  <blockquote>
  <pre><code>Input #0, truehd, from 'C:\[]\[]\[]\test.mlp':
    Duration: N/A, start: 0.000000, bitrate: N/A
  </code></pre>
  </blockquote>
  <p>No duration, no bitrate in your <code>.mlp</code> file. MLP format (container) is raw, it doesn't contain metadata (as a duration and bitrate).</p>
  <p>Moreover, <code>-acodec copy</code> in your <code>ffmpeg</code> command simply copies the mlp audio as a stream of bytes, obtaining no info beyond number of bytes.</p>
  <p>So FFmpeg has hard time to estimate the duration of your audio</p>
  <ul>
  <li>no direct info about duration,</li>
  <li>no bitrate info for a fair estimation,</li>
  <li>it has some info from your audio stream (as the sample rate and the bit depth),</li>
  <li>it may know the size (in bytes) of your audio stream.</li>
  </ul>
  <p>It means that the duration of your audio is guessed roughly enough, which results in such a difference (the <code>-shortest</code> option is based only on such an approximation).</p>
  <p>One possibility how to fix it is using the <code>-t</code> option (for total time) instead of <code>-shortest</code>, for example</p>
  <pre><code>ffmpeg -i test.mlp -f lavfi -i color=c=blue:s=640x480:r=15 -acodec copy -t &quot;10:02&quot; output.mkv
  </code></pre>
  <p>(you may use apostrophes instead of quotes – it depends on your operating system, or simply express the time in seconds: <code>-t 602</code>).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-30T12:38:28.167Z
Answers.LastActivityDate: 2022-01-30T12:48:08.670Z
Answers.LastEditDate: 2022-01-30T12:48:08.670Z
Answers.UserDisplayName: MarianD
Body: <p>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:</p>
  <pre><code>ffmpeg -i test.mlp -f lavfi -i color=c=blue:s=640x480:r=15 -acodec copy -shortest output.mkv
  </code></pre>
  <p><code>ffprobe</code> on the .mlp audio is as follows:</p>
  <pre><code>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)
  </code></pre>
  <p>any idea how to force a true &quot;shortest&quot; output?  thanks!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-30T11:06:54.947Z
Comments.Text: Please include the output from your `ffmpeg` command, too.
Comments.UserDisplayName: MarianD
Tags: <ffmpeg><mkv>
Title: ffmpeg "-shortest" yielding a clip longer than audio file
UserDisplayName: chris
ThreadText: # ffmpeg "-shortest" yielding a clip longer than audio file
  
  (Asked by: username_0 on 2022-01-29)
  
  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!
  
  **Tags:** ffmpeg, mkv
  
  > **Comments:**
  > **username_1**: Please include the output from your `ffmpeg` command, too.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-30. Score: 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`).
  
  
  ---
  
  