Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder with a MP3 audio file and an video file. Both named the same.

  • Example.mp3
  • Example.mp4

I want to play the video and add the sound.
Both files should stay the same and I do not want any new file with both in it.

Is there a way to get it done with the command line?

share|improve this question
Just a start for others who want to help: Theoretically VLC can do this via its GUI. Next step would be to find the correct command line syntax – nixda Dec 8 '13 at 11:52
OK i did manage to find the Command line Syntax its: % vlc audiofile --input-slave videofile – Atlus Dec 13 '13 at 0:21
Please post your solution as an answer. You could and should also accept your own answer – nixda Dec 14 '13 at 16:56

How to play a soundless video and add a audio file at the same time?
I want to play the video and add the sound.

With the (experimental) --input-slave swtich.

Is there a way to get it done with the command line?

If your video has no audio tracks, then you can simply use something like the following:

vlc example.mp4 --input-slave=example.mp3

If your video does have an audio track, then VLC will use that by default, so you have to specify the alternate track as so:

vlc exmaple.mp4 --input-slave=example.mp3 --audio-track=1

If your video has two audio tracks, then you would use --audio-track=2 and so on (the first track is 0, so the number you use for the external audio is equal to the number audio tracks in the video).

Also, you can (currently) only specify a single external audio track, so this will not work:

vlc example.mp4 --input-slave=example.mp3 --input-slave=example2.mp3

In this case, VLC only uses the last one specified.

share|improve this answer

I wanted the same thing it seems. I have an app launcher I wrote in powershell, and of the things I have it doing is to create a random 8-track playlist from my music library and it slaves a random visualization video over the top in fullscreen mode.

Looks something like this: vlc.ps1

#cache variables
$videopath = "C:\path\to\your\mp4\videos"
$musicpath = "C:\path\to\your\music"
$numtracks = 8
$slave = @()
$slavecount =0
$rand = 0
$track = ""

#Grab a random video
Get-Childitem -Path $videopath -Include *.mp4, *.avi, *.mkv -Recurse |
    Foreach {
        # Flip those slashes around
        $slave += $_.Fullname  -replace "\\","/"
   $slavecount = $slave.Count

# Build a random 8-track
Get-Childitem -Path $musicpath -Include *.mp3, *.flac -Recurse |
    Get-Random -Count $numtracks |
    Foreach {
        #Choose a random video from the array of videos
        # This only used if they fix VLC to allow multiple slaves
        $rand = Get-Random -Minimum 0 -Maximum $slavecount

        # Add the double quotes just how vlc likes it
        $track = """" + $_.Fullname + """"

        if ($i -lt 1) {
            #start vlc, queue your first track and slave the random visualization
            vlc --started-from-file --play-and-stop $track --input-slave=file:///$slave[$rand] --fullscreen   
        } else {
            #now enqueue the remaining tracks
            #if multiple slaves are eventually supported this whole if statement can be removed
            vlc --started-from-file --playlist-enqueue $track

share|improve this answer
Note: input slave is still pretty fussy imo. I left the loop in hopes that in the future, you will be able tp slave more than one file. – user3067533 Mar 9 at 20:38
Note: input slave is slaved to the track not the queue. So your video should be short and sweet with a graceful start-end loop as it can be jarring when the video abruptly resets every track. I muxed a bunch of these together in various orders and it seems to do the trick of randomizing the visualizations – user3067533 Mar 9 at 20:42
Currently using these: – user3067533 Mar 9 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .