<p>I have a video file that contains 4 streams, 3 videos streams and one steam for metadata.</p>
<p>Stream Info:</p>
<pre><code>Input #0, matroska,webm, from 'output_master.mkv':
Metadata:
title           : Azure Kinect
encoder         : libmatroska-1.4.9
creation_time   : 2021-05-20T12:11:15.000000Z
K4A_DEPTH_DELAY_NS: 0
K4A_WIRED_SYNC_MODE: MASTER
K4A_COLOR_FIRMWARE_VERSION: 1.6.110
K4A_DEPTH_FIRMWARE_VERSION: 1.6.79
K4A_DEVICE_SERIAL_NUMBER: 000123102712
K4A_START_OFFSET_NS: 298800000
Duration: 00:00:40.03, start: 0.000000, bitrate: 480934 kb/s

Stream #0:0(eng): Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 2048x1536, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : COLOR
  K4A_COLOR_TRACK : 14499183330009048
  K4A_COLOR_MODE  : MJPG_1536P
Stream #0:1(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : DEPTH
  K4A_DEPTH_TRACK : 429408169412322196
  K4A_DEPTH_MODE  : NFOV_UNBINNED
Stream #0:2(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : IR
  K4A_IR_TRACK    : 194324406376800992
  K4A_IR_MODE     : ACTIVE
Stream #0:3: Attachment: none
Metadata:
  filename        : calibration.json
  mimetype        : application/octet-stream
  K4A_CALIBRATION_FILE: calibration.json
</code></pre>
<p>I am using this command to extract the first stream:</p>
<pre><code>ffmpeg -i output_master.mkv -c copy  -map 0:v:0 out_1.mkv
</code></pre>
<p>For the other two streams, I am using this command:</p>
<pre><code>ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:1 out_2.mkv
ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:2 out_3.mkv
</code></pre>
<p>I do not know if I am using the right commands to extracting the video streams.</p>

CC BY-SA 4.0
2023-04-23T04:08:57.513Z
It seems that you extracted correct video streams (you may omit the `v:` part as the all 3 first streams are video streams). What's your problem?
MarianD
CC BY-SA 4.0
2023-04-23T12:38:08.153Z
When I am extracting the stream, the stream information gets changed for all the streams. For example, `Original` Stream #1 info: `Stream #0:1(eng): Video: rawvideo (b16g / 0x67363162), gray16be.....,` and after extracting the stream, it changes to `Stream #0:1(eng): Video: rawvideo, rgb555le, 640x576,...` I do not want to change anything.
Ashutosh Singla
CC BY-SA 4.0
2023-04-23T22:17:36.727Z
It would be nice from you to append your comment directly to your question. The stream properties are changed because it will be *transcoded* (i.e. decoded and then encoded with **ffv1** codec, as you specified in  `-c:v ffv1` option). Use `-c:v copy` instead, but without other options for changing the stream's properties.
MarianD
<ffmpeg><video-editor><windows><libx264>
Extracting multiple video streams using FFmpeg
Ashutosh Singla
# Extracting multiple video streams using FFmpeg

(Asked by: username_0 on 2023-04-11)

I have a video file that contains 4 streams, 3 videos streams and one steam for metadata.
Stream Info:
Input #0, matroska,webm, from 'output_master.mkv':
Metadata:
title           : Azure Kinect
encoder         : libmatroska-1.4.9
creation_time   : 2021-05-20T12:11:15.000000Z
K4A_DEPTH_DELAY_NS: 0
K4A_WIRED_SYNC_MODE: MASTER
K4A_COLOR_FIRMWARE_VERSION: 1.6.110
K4A_DEPTH_FIRMWARE_VERSION: 1.6.79
K4A_DEVICE_SERIAL_NUMBER: 000123102712
K4A_START_OFFSET_NS: 298800000
Duration: 00:00:40.03, start: 0.000000, bitrate: 480934 kb/s

Stream #0:0(eng): Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 2048x1536, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : COLOR
  K4A_COLOR_TRACK : 14499183330009048
  K4A_COLOR_MODE  : MJPG_1536P
Stream #0:1(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : DEPTH
  K4A_DEPTH_TRACK : 429408169412322196
  K4A_DEPTH_MODE  : NFOV_UNBINNED
Stream #0:2(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
  title           : IR
  K4A_IR_TRACK    : 194324406376800992
  K4A_IR_MODE     : ACTIVE
Stream #0:3: Attachment: none
Metadata:
  filename        : calibration.json
  mimetype        : application/octet-stream
  K4A_CALIBRATION_FILE: calibration.json

I am using this command to extract the first stream:
ffmpeg -i output_master.mkv -c copy  -map 0:v:0 out_1.mkv

For the other two streams, I am using this command:
ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:1 out_2.mkv
ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:2 out_3.mkv

I do not know if I am using the right commands to extracting the video streams.

**Tags:** ffmpeg, video-editor, windows, libx264

> **Comments:**
> **username_1**: It seems that you extracted correct video streams (you may omit the `v:` part as the all 3 first streams are video streams). What's your problem?  
> **username_0**: When I am extracting the stream, the stream information gets changed for all the streams. For example, `Original` Stream #1 info: `Stream #0:1(eng): Video: rawvideo (b16g / 0x67363162), gray16be.....,` and after extracting the stream, it changes to `Stream #0:1(eng): Video: rawvideo, rgb555le, 640x576,...` I do not want to change anything.  
> **username_1**: It would be nice from you to append your comment directly to your question. The stream properties are changed because it will be *transcoded* (i.e. decoded and then encoded with **ffv1** codec, as you specified in  `-c:v ffv1` option). Use `-c:v copy` instead, but without other options for changing the stream's properties.  

---

## 0 answers

