title: Troubleshooting ffmpeg batch-file. mkv to mp4 conversion with subtitle hardcode
body: <p>I am trying to batch convert a large number of .mkv video files to .mp4 while hard coding the subtitles included in the .mkv files. I would like to retain as much quality as possible.</p>
  
  <p>I am not an adapt at using ffmpeg or writing batch files, so I have been searching online for batch files which will do what I need. I found some which successfully convert without the subtitles, and I found one that included the command for hard coding the subtitles, but that one also had excessive commands that I didn't want to delve into, so I am attempting to combined the relevant parts of the two scripts. That is where the problem is obviously coming from.</p>
  
  <pre><code>for %%a in (*.mkv) do ffmpeg -i "%%~a" -vf subtitles=%%~na.mkv copy -c:a aac -q:a 100 "%%~na.mp4"
  pause
  </code></pre>
  
  <p>It is worth noting that the script was originally:</p>
  
  <pre><code>for %%a in (*.mkv) do ffmpeg -i "%%~a" -vcodec copy -c:a aac -q:a 100 "%%~na.mp4"
  pause
  </code></pre>
  
  <p>But I changed it as best I could to include a section of script I found which should apparently hard code the subtitles. My lack of knowledge about how this scripting language actually functions probably just made me insert the command in the wrong place or in the wrong way. I hope that background information makes this problem easier to solve.</p>
  
  <p>Expected results: convert each .mkv file in the current folder and leave the .mp4 file in the same folder.</p>
  
  <p>Actual results:</p>
  
  <pre><code>[NULL @ 0000026a399f1440] Unable to find a suitable output format for 'copy': Invalid argument.
  </code></pre>