title: Optimizing Adaptive Streaming with FFMPEG
body: <p>I am working on a video on demand website, I am using laravel 5.7, FFMPEG and DASH player from (dashif.org). Got some questions.</p>
  
  <p>Extracting audio like:</p>
  
  <pre><code>ffmpeg -i original.mp4 -vn -acodec libvorbis -ab 128k -dash 1 my_audio.webm
  </code></pre>
  
  <p>Converting video like: </p>
  
  <pre><code>ffmpeg -i original.mp4 -c:v libvpx-vp9 -keyint_min 150 \
  -g 150 -tile-columns 4 -frame-parallel 1  -f webm -dash 1 \
  -an -vf scale=160:190 -b:v 250k -dash 1 video_160x90_250k.webm \
  -an -vf scale=320:180 -b:v 500k -dash 1 video_320x180_500k.webm \
  -an -vf scale=640:360 -b:v 750k -dash 1 video_640x360_750k.webm \
  -an -vf scale=1280:720 -b:v 1500k -dash 1 video_1280x720_1500k.webm
  </code></pre>
  
  <p>Creating manifest like:</p>
  
  <pre><code>ffmpeg \
  -f webm_dash_manifest -i video_160x90_250k.webm \
  -f webm_dash_manifest -i video_320x180_500k.webm \
  -f webm_dash_manifest -i video_640x360_750k.webm \
  -f webm_dash_manifest -i video_1280x720_1500k.webm \
  -f webm_dash_manifest -i my_audio.webm \
  -c copy \
  -map 0 -map 1 -map 2 -map 3 -map 4 \
  -f webm_dash_manifest \
  -adaptation_sets "id=0,streams=0,1,2,3 id=1,streams=4" \
  my_video_manifest.mpd
  </code></pre>
  
  <p>Now the problems:</p>
  
  <ol>
  <li>Video conversion takes a lot of time on the latest i5 8gb
  think-pad running Ubuntu 18. 4minute mp4 took more than 30minute. 10minute, 720p MP4 took forever, had to kill the process. Is
  that normal? Any idea to optimize? </li>
  <li>Need to find out original
  video's dimension so that I can avoid dimension conversion more than
  the original. <code>ffprob</code> looks fine in command but produces too much of
  information than required, is there any simple function?</li>
  <li>Converted webm file is bigger in size than original mp4, original
  mp4 of 720p was 33MB, but 640p webm is 76MB. Is that normal or
  something wrong?</li>
  </ol>
  
  <p>Any suggestions to optimize the process are welcome.</p>