title: ffmpeg errors out with Error initializing output stream 0:0 for the setting `-profile:v main`
body: <p>We are using ffmpeg for generating HSL streaming files (.m3u8, .ts) from multiple type of input video and audio like avi, mp4, mp3, mkv, m4a etc. We are trying to encode everything into h264 streams to support modern browsers. But we are facing issues in converting few videos of type avi and mp4 (not all). Below is the ffmpeg command (it's using ffmpeg fluent on NodeJS).</p>
  <pre class="lang-js prettyprint-override"><code>ffmpeg(fileName)
    .outputOptions([
      '-c:v h264',
      '-profile:v main',
      `-vf scale=1280:-2`,
      '-hls_list_size 0',
      '-start_number 0',
      '-hls_time 10',
      '-loglevel error',
    ])
    .output(output_file_path)
  </code></pre>
  <p>When we try to run this with some set of specific avi and mp4 samples, it errors out saying
  <code>Error: ffmpeg exited with code 1: 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</code>.</p>
  <p>I tried changing few commands (like providing crf value) and tried to run them, The only time it successfully converted converted them was when I removed the output option <code>-profile:v main</code>. I am not sure about the reason behind it.</p>
  <p>I ran ffprobe to get the information from the videos that were not able to generate streams. I have them uploaded to gist here: <a href="https://gist.github.com/vishwasnavadak/91b5c978e2a3cb7a7c7a2bb505487263" rel="nofollow noreferrer">https://gist.github.com/vishwasnavadak/91b5c978e2a3cb7a7c7a2bb505487263</a></p>
  <p>Is there something I am missing? What is the reason for it to error out when <code>-profile:v main</code> option is present?</p>