How to ignore certain type of streams (mjpeg) while encoding videos in ffmpeg I've several mkv files which have streams similar following. These files may have more than one audio stream and/or subtitles e.t.c. But my problem is mjpeg streams.

Stream #0:0 -&gt; #0:0 (h264 (native) -&gt; h264 (h264_nvenc))
Stream #0:1 -&gt; #0:1 (ac3 (native) -&gt; vorbis (libvorbis))
Stream #0:2 -&gt; #0:2 (mjpeg (native) -&gt; h264 (h264_nvenc))
Stream #0:3 -&gt; #0:3 (mjpeg (native) -&gt; h264 (h264_nvenc))
Stream #0:4 -&gt; #0:4 (mjpeg (native) -&gt; h264 (h264_nvenc))
Stream #0:5 -&gt; #0:5 (mjpeg (native) -&gt; h264 (h264_nvenc))


when i try to encode my video i get this error


  Error while opening encoder for output stream #0:2 - maybe incorrect
  parameters such as bit_rate, rate, width or height


my command is

ffmpeg -i "%%~nf%%~xf" -c:v h264_nvenc -b:v 3000k -minrate 3000k -maxrate 3000k -vf "scale=1280:-2" -acodec libvorbis -ac 6 -c:s copy -map 0 "done/%%~nf.mkv"


how can i ignore mjpeg streams not to be copied to output video, or at least how to properly copy them to output video without getting error.
You can avoid the MJPEG cover art by using properly ordered selective mapping:

-map 0 -map -v -map V


What this does:


-map 0 Map all streams from input 0 (which is the first input per ffmpeg command).
-map -v Then, ignore all video streams including cover art.
-map V Finally, include all non-cover art video streams.


v matches all video streams, and V only matches video streams which are not attached pictures, video thumbnails or cover arts.

For more info see the documentation on stream specifiers and the -map option.