Linux 下的实时截屏直播

Linux 下的实时截屏直播

我在 Linux 下运行实时截屏时遇到了一些困难。我找到了 jtvlc 并尝试使用它,但每当我使用它时,流要么空白,要么滞后,延迟极高。我的互联网连接和计算机都很快,但我是否可能对它施加了太多负担?

关于我可能做错了什么有什么想法吗?

# 1. Get an account on http://www.justin.tv/
# 2. Copy streaming key from: http://www.justin.tv/broadcast/adv_other
# 2. Install VLC: http://www.videolan.org/vlc/
# 3. Get Win/Mac/Lin Stream Client: \
# http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API
# 4. Adjust the vlc parameters to your liking and run VLC like this

#!/bin/bash
cvlc screen:// --input-slave=pulse:// \
    --screen-width 1920 \
    --screen-height 1080 \
    --screen-fps 5 \
    -v input_stream \
    --sout='#duplicate{ dst="transcode{ scale=1, venc=x264{ keyint=60 }, vcodec=h264, vb=600, acodec=mp4a, ab=32, channels=2, samplerate=22050 } :rtp{dst=127.0.0.1,port=1234,sdp=file:///tmp/vlc.sdp} "}' \
    --sout-transcode-threads=4 & sleep 2

# 5. Run JTVLC to stream like this:
./jtvlc/jtvlc omnipotententity censored /tmp/vlc.sdp

# Notes:
#- If you want to see what you're about to stream add 'dst=display, '
# before 'dst="transcode['
# More about the VLC parameters: http://wiki.videolan.org/Documentation:Modules/screen

更新:

我已经解决了我的问题……大部分。我试图通过上游发送太多信息。从那时起,我降低了分辨率并使用了 x264 的 crf 选项。

现在我的脚本如下所示:

# 1. Get an account on http://www.justin.tv/
# 2. Copy streaming key from: http://www.justin.tv/broadcast/adv_other
# 2. Install VLC: http://www.videolan.org/vlc/
# 3. Get Win/Mac/Lin Stream Client: \
# http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API
# 4. Adjust the vlc parameters to your liking and run VLC like this

#!/bin/bash
cvlc screen:// --input-slave=pulse:// \
    --screen-width 1920 \
    --screen-height 1080 \
    --screen-fps 5 \
    -v input_stream \
    --sout='#duplicate{ dst="transcode{ scale=1, width=1280, height=720, venc=x264{ keyint=60, crf=35 }, vcodec=h264, acodec=mp4a, ab=32, channels=2, samplerate=22050 } :rtp{dst=127.0.0.1,port=1234,sdp=file:///tmp/vlc.sdp} "}' \
    --sout-transcode-threads=4 & sleep 2

# 5. Run JTVLC to stream like this:
./jtvlc/jtvlc omnipotententity redacted /tmp/vlc.sdp

# Notes:
#- If you want to see what you're about to stream add 'dst=display, '
# before 'dst="transcode['
# More about the VLC parameters: http://wiki.videolan.org/Documentation:Modules/screen

话虽如此,我还是遇到了一些问题。有时当我大量更改屏幕上的内容时,它无法正确编码。这很奇怪,因为通过 Skype 4.0 进行屏幕录制工作正常。因此,仍有一些问题需要解决。

我将悬赏保留,并积极尝试上述内容。尽管我自己解决了问题,但我仍会分配悬赏。

答案1

这可能是瞎猜,但我有一种感觉

--屏幕帧速率5\

应该是问题所在。尝试将 5 更改为更高的值(例如 50),然后看看会发生什么。

答案2

您可以尝试的另一种产品:

GNU/Linux 版 WebcamStudio

答案3

尝试这个..!

# 1. Get an account on http://www.justin.tv/
# 2. Copy streaming key from: http://www.justin.tv/broadcast/adv_other
# 2. Install VLC: http://www.videolan.org/vlc/
# 3. Get Win/Mac/Lin Stream Client: \
#    http://apiwiki.justin.tv/mediawiki/index.php/Linux_Broadcasting_API
# 4. Adjust the vlc parameters to your liking and run VLC like this

#!/bin/bash
cvlc screen:// \
    --screen-width 1576 \
    --screen-height 886 \
    --screen-fps 5 \
    --screen-caching 200 \
    --screen-top 75 \
    -v input_stream \
    --sout='#duplicate{ dst="transcode{ scale=1, width=630, height=354, venc=x264{ keyint=60 }, codec=h264, vb=600, acodec=mp4a, ab=32, channels=2, samplerate=22050 } :rtp{dst=127.0.0.1,port=1234,sdp=file:///tmp/vlc.sdp} "}' \
    --sout-transcode-threads=2 &

# 5. Run JTVLC to stream like this:
jtvlc justintvusername streamkey /tmp/vlc.sdp

# Notes:
#- If you want to see what you're about to stream add 'dst=display, '
# before 'dst="transcode['
# More about the VLC parameters: http://wiki.videolan.org/Documentation:Modules/screen

如果不起作用你可以尝试在 GNU/Linux 上通过 DLNA 进行实时桌面流式传输

相关内容