Showing posts with label ffmpeg. Show all posts
Showing posts with label ffmpeg. Show all posts

December 30, 2016

ffmpeg map 0 number of streams must match number of output streams

If a media file has more than one stream type, ffmpeg will choose only one:

By default, ffmpeg includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file. It picks the "best" of each based upon the following criteria: for video, it is the stream with the highest resolution, for audio, it is the stream with the most channels, for subtitles, it is the first subtitle stream. In the case where several streams of the same type rate equally, the stream with the lowest index is chosen.

If you need to copy all streams, use the “-map 0” option.

However, if it fails with “Number of stream maps must match number of output streams”, try upgrading your ffmpeg version, or replace it with libav.

To do that,

  • apt-get install libav-tools
  • run “avconv” with the same arguments you used for ffmpeg

ffmpeg codec input stream subtitles

When trying to convert an .mkv file with .ass subtitles, ffmpeg gave me the following error:

decoder: codec not found for input stream

turns out, it fails to detect and convert the subtitles coded. there are two options that i know of:

  • disable the subtitles for that video file, use the “-sn” option
  • simply copy the subtitles codec, use “-scodec copy”

source & more info: https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options#Set_Subtitle_Codec