[vlc] Playing multiple video streams simultaneously with LibVLC

Jérôme Forissier jerome at taodyne.com
Tue Feb 18 11:56:56 CET 2014


Hi there,

I'm working on an application that uses LibVLC. The videos are rendered to memory (libvlc_video_set_callbacks/libvlc_video_set_format_callbacks) and then made available to other parts of the application as OpenGL textures. Now I need to play MP4 files that contain several video streams [1]. I want *multiple* streams to play simultaneously (typically, all of them, but not always).
Is this use case supported?

Using VLC 2.1.3 I could almost get my use case to work -- all the video streams play fine.
-The setup callback of libvlc_video_set_format_callbacks is called once for each video stream present in the MP4 container
- In setup() I set *opaque to a different value for each stream, so that the display callback may know what to do with the decoded pictures. I return 0 for streams I don't want to decode.

The problem is : how can I identify the streams? Is it possible to retrieve the stream number (0..n) or stream ID from within the setup callback? Unfortunately, streams are not always passed to setup() in the same order so I cannot rely on the order to infer the stream number.

Thanks.

-- 
Jerome

[1] $ ffmpeg -i test.mp4 2>&1 | grep Stream
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:1(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:2(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:3(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:4(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 179 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:5(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:6(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 179 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)
    Stream #0:7(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 180 kb/s, 25 fps, 25 tbr, 25k tbn, 25 tbc (default)




More information about the vlc mailing list