Search code examples
video-streamingmp4

How to play video with multiple video streams?


As the subject described, I have a video which has more than one video streams,How can I play this kind of videos?When I play using ffplay, seems that only the first video stream can be played, and how to switch to other video streams?

The following video information is from ffmpeg:

Duration: 00:00:19.97, start: 0.000000, bitrate: 1538035 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 31211 kb/s, 29.99 fps, 30 tbr, 1200k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 31217 kb/s, 29.99 fps, 30 tbr, 1200k tbn, 60 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:2(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 31216 kb/s, 29.99 fps, 30 tbr, 1200k tbn, 60 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:3(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 31257 kb/s, 29.99 fps, 30 tbr, 1200k tbn, 60 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:4(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 31266 kb/s, 29.99 fps, 30 tbr, 1200k tbn, 60 tbc
    Metadata:
      handler_name    : VideoHandler

Solution

  • VLC and ffplay can play this kind of videos.

    • VLC

    Click Video->Video Track to select the desired video stream.

    • ffplay

    When playing with ffplay, click "v" to switch the video streams.

    An open source media player ijkplayer can also play this kind of videos.The demo show you how to play it.And the relevant interfaces in source codes are :

    1. selectTrack
    2. deselectTrack