[FFmpeg-user] Specifying Video Stream with V instead of v
Josh Marell
macman104 at gmail.com
Mon Nov 9 09:47:32 CET 2015
In the documentation for ffmpeg, it states:
*stream_type is one of following: ’v’ or ’V’ for video, ’a’ for audio, ’s’
for subtitle, ’d’ for data, and ’t’ for attachments. ’v’ matches all video
streams, ’V’ only matches video streams which are not attached pictures,
video thumbnails or cover arts.*
So I have a command to convert a file from h264 to h265 which is:
ffmpeg -i filename.mkv -map 0 -c copy -c:v libx265 265_filename.mkv
However, recently, I have some files that have mpjeg streams for cover art.
They are picked up as video to be converted, which causes an error.
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (h264 (native) -> hevc (libx265))
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (mjpeg (native) -> hevc (libx265))
Stream #0:4 -> #0:4 (mjpeg (native) -> hevc (libx265))
Stream #0:5 -> #0:5 (mjpeg (native) -> hevc (libx265))
Stream #0:6 -> #0:6 (mjpeg (native) -> hevc (libx265))
So, I thought I would use -c:V instead of -c:v. I tested this with ffprobe,
with little v, it correctly shows all the streams:
ffprobe -v error -show_entries "stream=codec_name" -select_streams v
filename.mkv
[STREAM]
codec_name=h264
[/STREAM]
[STREAM]
codec_name=mjpeg
[/STREAM]
[STREAM]
codec_name=mjpeg
[/STREAM]
[STREAM]
codec_name=mjpeg
[/STREAM]
[STREAM]
codec_name=mjpeg
[/STREAM]
And switching to using capital V, correctly shows only the one stream
ffprobe -v error -show_entries "stream=codec_name" -select_streams V
filename.mkv
[STREAM]
codec_name=h264
[/STREAM]
However, when I carry this convention over to ffmpeg with:
ffmpeg -i filename.mkv -map 0 -c copy -c:V libx265 265_filename.mkv
It gives the exact same behavior as the lowercase v option, and again tries
to convert all the video streams (including the mpjeg), not just the H264
stream like the ffprobe command does.
Is this intended behavior? Is it a bug? Am I misunderstanding something
else entirely about the documentation or the two commands?
I realize that I can also specify -c:v:0 to get the first video stream
(which should be my desired one). But I am batch processing a large number
of video files and I can't always make that assumption.
I apologize if the message is long, but I wanted to do my best to be
thorough and clear in my explanation of the problem I'm encountering.
Thank you for your time and assistance in understanding this behavior.
More information about the ffmpeg-user
mailing list