0
votes

I am trying to stream a video with 2 audio tracks using LibVLC and the --sout-all option. I know there are two audio tracks in the movie, but I cant seem to get the options right, so Vlc streams only one.

(vlc versions 2.0.5/2.0.8 ubuntu 12.0.4 on a not too fast intel atom nettop)

def change_media(instance, player, video_port, item, multicast_address, video_offset=0.0):
    """
    Change video
    """
    param=[
        "%s" % item
        ,"start-time=%d" % video_offset
        ,"sout-all"
        ,"sout-udp-ttl=1"
        ,"ttl=1"
        ,"sout=#standard{access=udp,dst=%s:%d,mux=ts{pid-video=68,pid-audio=70}}"%(
                multicast_address,
                video_port
            )
        ]
    media = instance.media_new(*param)
    player.set_media(media)

I seem to be no better at getting the --sout-all option working when trying from the command line.

vlc -vvv land.mp4 --sout-all --sout=#standard{access=udp,dst=224.1.1.1:5555,mux=ts{pid-video=68,pid-audio=70}}

Here are some lines from the log - I hope it is enough - see (disable)

[0x853c498] mp4 demux debug: adding track[Id 0x1] video (enable) language undef
[0x853c498] mp4 demux debug: track[Id 0x2] read 26658 chunk
[0x853c498] mp4 demux debug: track[Id 0x2] read 213263 samples length:4549s
[0x853c498] mp4 demux debug: adding track[Id 0x2] audio (enable) language eng
[0x853c498] mp4 demux debug: track[Id 0x3] read 26658 chunk
[0x853c498] mp4 demux debug: track[Id 0x3] read 213263 samples length:4549s
[0x853c498] mp4 demux debug: adding track[Id 0x3] audio (disable) language fra

And this showing only two tracks:

[0x85494b8] main stream output debug: adding a new sout input (sout_input:0xb5003c70)
[0x853de98] main mux debug: adding a new input
[0x853de98] mux_ts mux debug: adding input codec=h264 pid=68
[0x853de98] mux_ts mux debug: new PCR PID is 68
[0x85494b8] main stream output debug: adding a new sout input (sout_input:0xb042f630)
[0x853de98] main mux debug: adding a new input
[0x853de98] mux_ts mux debug: adding input codec=mp4a pid=70
[0x853de98] mux_ts mux debug:     - lang=eng
1

1 Answers

0
votes

While this is not strictly an answer in the narrow sense it is the workaround I found.

As I said before I was sure the movie held 2 audio tracks, while it disabled one when playing.

I had previously streamed another movie with success, but what was the difference? One had been ripped with handbrake and the other had been through ffmpeg.

I decided to run the handbrake-ripped file through ffmpeg to see if it made a difference:

ffmpeg.exe -i land.mp4 -map 0:0 -map 0:1 -map 0:2 land2.mp4

That was it - now streaming video and 2 audio tracks was indeed possible.

While I can't really say if it is an error in either program (or an error in usage) this should help others finding themselves in the same situation.