e1ioan / rokuphp

32 stars 9 forks source link

NO SOUND when Live Broadcast? Read this #16

Open e1ioan opened 3 years ago

e1ioan commented 3 years ago

To fix it, edit /var/www/html/broadcastm.php and replace if ( ! $sound) with if( ! $doaudio) at line 215.

For better quality of stream, change /var/www/html/config/streamer.xml to look like this (keep your streaming keys for youtube and twitch):

<?xml version="1.0" encoding="UTF-8"?>
<xml>
    <app>
       <name_>ffmpeg</name_>
       <name>ffmpeg -loglevel error</name>
    </app>
    <audio>
       <disable>-f lavfi -i anullsrc</disable>
    </audio>
    <hls>
        <infile_options>-thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i</infile_options>
        <outfile_options>-c:v copy -c:a copy -hls_flags delete_segments</outfile_options>
        <outfile_dir>/dev/shm/</outfile_dir>
    </hls>
    <live>
        <platform>
            <name>YouTube</name>
            <infile_options>-thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i</infile_options>
            <outfile_options>-c:v copy -c:a copy -f flv rtmp://a.rtmp.youtube.com/live2/</outfile_options>
        <key>xxx</key></platform>
        <platform>
            <name>Twitch</name>
            <infile_options>-thread_queue_size 512 -rtsp_transport +udp+tcp -rtsp_flags prefer_tcp -i</infile_options>
            <outfile_options>-c:v copy -c:a aac -f flv rtmp://live.twitch.tv/app/</outfile_options>
        <key>xxx</key></platform>
    </live>
</xml>

I'll put the changes in the code when I have some time.