title: Video file split with VLC from the command line gives garbage duration times for split files
body: <p>I have a late 2011 MBP, running Mac OS X 10.7.5, 2.3 GHz Intel Core i5, with 16GB 1600 MHz DDR3.</p>
  
  <p>I wrote the script below to cut up video files in vlc (tested with VLC 1.1.3 and 2.2.1). The script works, however the output files have "dud" durations of 384592 hours</p>
  
  <pre><code>#!/bin/bash
  filename=test.mkv
  duration=`ffprobe -show_format $filename | sed -n '/duration/s/.*=//p'`
  duration=${duration/.*}
  interval=120
  start=0
  n=$start
  stop=$interval
  while [ $duration -ge 0 ]; do
      /Applications/VLC.app/Contents/MacOS/VLC -Idummy $filename --start-time $start --stop-time $stop --sout=#file{dst=$n-out-$filename} vlc://quit
      let start=stop
      let stop=stop+interval
      let duration=duration-interval
      echo "Number of seconds left to process: $duration"
      let n=n+1
  done
  </code></pre>
  
  <h2>Can anybody share any insight as to why VLC is behaving this way or is it my script?</h2>
  
  <hr>
  
  <h1>Update</h1>
  
  <p>The issue has something to do with the way VLC handles mkv files.  When I split an mp4 file vs an mkv file the issue went away.  Would still be good to know what is going on with the mkv.</p>
  
  <h2>.MKV split</h2>
  
  <p>with the issue, the files are ~2 min in duration NOT 384,592 hours
  <img src="https://i.stack.imgur.com/bBDNg.png" alt="enter image description here"></p>
  
  <h2>.MP4 split</h2>
  
  <p>without the issue, the files lengths are displayed correctly for mp4 files
  <img src="https://i.stack.imgur.com/vfyib.png" alt="enter image description here"></p>