vlc command to play a silent video mutes matlab

2 views (last 30 days)
Hello,
I am using MATLAB (2018b) and Cogent 2000 toolbox to prepare an experiment which will present a silent video + audio stimuli on the same time. So, within the code of the experiment I am using this command:
system('start "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --play-and-exit instructionsANDstimuli\Donald.mp4 --no-qt-name-in-title -f -q --width 640 --height 480 --start-time 4 --stop-time 14 --no-osd --no-autoscale --no-keyboard-events --no-mouse-events --intf dummy --dummy-quiet &');
Then follows the for loop for the presentation of the audio stimuli.
So, what I am expecting is to watch the silent video while listening to the audio stimuli. Unfortunately, what is happenning is that I am watching only the video with no audio stimuli.
Note that:
  1. Donald.mp4 is a silent video
  2. When I am running the code without the video I can hear the audio stimuli properly.
  3. I have tried the following options with no success: --no-audio, --no-sout-audio, --spdif, --no-audio --no-sout-audio, --no-audio --spdif, --spdif --no-sout-audio, --no-audio --no-sout-audio --spdif, --spdif, --aout none.
  4. There is sound output from other applications (ex: spotify) while MATLAB is mute
Is there something wrong with the video or audio options in the command system(start ...)? Do you know what may resolve this issue?
Thank you very much for your time!!

Answers (1)

Munish Raj
Munish Raj on 1 Mar 2019
Hello Varvara,
The operating system is designed such that only one audio source is allocated all the child processes of a process.
MATLAB is the parent process and every code run from MATLAB is a child of MATLAB.
The system command is initiated from MATLAB, hence VLC which is initiated from MATLAB is also a child of MATLAB.
Only one(VLC/MATLAB code) can use the audio resource.
Even though there is no audio output from VLC, VLC uses the audio resource.
Hence MATLAB can not access the Audio resource.
However, external applications can play audio at the same time because these applications are not a a child process of MATLAB.
To achieve your task, you can use MATLAB’s in-buit video player instead of VLC.
To play a video stored in your computer using MATLAB’s movie player
implay(filename)
  1 Comment
looking for answers
looking for answers on 1 Mar 2019
Hello Munish Raj,
Thank you for your response.
I tried the command implay but the video starts after the for loop even though the command is placed before.
Perhaps I should look whether it is possible to allocate a different audio source to VLC and Cogent 2000.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!