樹莓派架設 RTMP 串流(Streaming)伺服器,傳送即時攝影機影像

這裡介紹使用樹莓派安裝 nginx 架設 RTMP 串流伺服器,傳送即時的攝影機影像。

樹莓派加上一個網路攝影機(webcam)之後,就可以用來打造一個即時的 live 影像串流伺服器,作為簡單的監控設備,讓您透過電腦或是手機看到即時的攝影機畫面。

在本篇教學中所使用的設備與規格為:

  1. 樹莓派 Raspberry Pi B+ 開發板
  2. 羅技 C170 視訊攝影機

以下是架設 RTMP 串流(Streaming)伺服器的安裝過程。

安裝 nginx 伺服器

我們選用 nginx 再加上一個 nginx-rtmp-module 模組作為主要對外服務的伺服器,在自行編譯與安裝之前,我們先用 apt 裝一下系統套件厙中的 nginx,然後在將其移除:

sudo apt-get update
sudo apt-get -y install nginx
sudo apt-get -y remove nginx
sudo apt-get clean

這樣做的目的是讓它自動把 nginx 相依的套件安裝好,並設定好系統的環境(例如 init 指令稿等),移除 nginx 套件之後,要清空 /etc/nginx/ 下面的設定檔:

sudo rm -rf /etc/nginx/*

安裝編譯用的套件:

sudo apt-get install -y curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev

建立系統上放置網頁的目錄:

sudo mkdir -p /var/www

建立編譯用的目錄:

mkdir -p ~/nginx_src
cd ~/nginx_src

git 下載 nginx 與 nginx-rtmp-module 的原始碼:

git clone https://github.com/arut/nginx-rtmp-module.git
git clone https://github.com/nginx/nginx.git

設定編譯參數:

cd nginx
./configure --prefix=/var/www --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --without-http_proxy_module --add-module=/home/pi/nginx_src/nginx-rtmp-module

這裡補充一點,從 nginx 的 git repository 下載的原始碼雖然是最新的,但是因為它是處於開發狀態的原始碼,並不保證一定可以使用,如果發現最新的原始碼有問題時,可以嘗試從 nginx 的官方網站下載打包好的原始碼,然後解壓縮:

wget http://nginx.org/download/nginx-1.9.3.tar.gz
tar zxvf nginx-1.9.3.tar.gz

然後再進入解壓縮出來的目錄,設定編譯參數:

cd nginx-1.9.3/
./configure --prefix=/var/www --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --without-http_proxy_module --add-module=/home/pi/nginx_src/nginx-rtmp-module

設定好編譯參數之後,就可以進行編譯與安裝 nginx 的動作:

make
sudo make install

測試安裝好的 nginx 是否正常:

nginx -v

正常的話,會顯示 nginx 的版本:
nginx version: nginx/1.7.10
編輯 /etc/nginx/nginx.conf 設定檔,在檔案的最後加上下面這段 RTMP 的設定:

rtmp {
  server {
    listen 1935;
    ping 30s;
    notify_method get;
    application rtmp {
      live on;
    }
  }
}

啟動 nginx 系統服務:

sudo service nginx start

看看是否有正常啟動,沒問錯誤訊息就代表成功了:
Starting nginx: nginx.

安裝 Strobe Media Playback

下載 Strobe Media Playback

mkdir strobe_src
cd strobe_src
wget http://downloads.sourceforge.net/project/smp.adobe/Strobe%20Media%20Playback%201.6%20Release%20%28source%20and%20binaries%29/StrobeMediaPlayback_1.6.328-full.zip

解壓縮之後,將最新版的複製到 /var/www/html/strobe

unzip StrobeMediaPlayback_1.6.328-full.zip
sudo cp -r for Flash Player 10.1 /var/www/html/strobe

建立 index.html

編輯 /var/www/html/index.html,將內容改為:

<!DOCTYPE html>
<html>
<head>
<title>Live Streaming</title>

<!-- strobe -->
<script type="text/javascript" src="strobe/lib/swfobject.js"></script>
<script type="text/javascript">
  var parameters = {  
     src: "rtmp://{pi_address}/rtmp/live",  
     autoPlay: false,  
     controlBarAutoHide: false,  
     playButtonOverlay: true,  
     showVideoInfoOverlayOnStartUp: true,  
     optimizeBuffering : false,  
     initialBufferTime : 0.1,  
     expandedBufferTime : 0.1,  
     minContinuousPlayback : 0.1,  
     poster: "images/poster.png"  
  };  
  swfobject.embedSWF(
    "strobe/StrobeMediaPlayback.swf"
    , "StrobeMediaPlayback"
    , 1024
    , 768
    , "10.1.0"
    , "strobe/expressInstall.swf"
    , parameters
    , {
      allowFullScreen: "true"
    }
    , {
      name: "StrobeMediaPlayback"
    }
  );
</script>

</head>
<body>
<div id="StrobeMediaPlayback"></div>
</body>
</html>

其中的 {pi_address} 要改為 SMTP 伺服器的 IP 位址(也就是樹莓派的 IP 位址)。

使用 avconv 製作影像串流

安裝 libav-tools 套件:

sudo apt-get install libav-tools

插上 USB 網路攝影機之後,執行:

avconv -f video4linux2 -r 24 -i /dev/video0 -f flv rtmp://localhost:1935/rtmp/live

這樣就可以開啟 http://{pi_address}/ 觀看即時的影像串流了,這是我測試的畫面:

avconv-streaming-1

如果畫面變動比較大的時候,Frame rate 會稍微下降。

avconv-streaming-2
因為 avconv 是使用軟體來進行影片的編碼,所以 CPU 的覆載會很高,以樹莓派的硬體而言,處理速度很吃緊。

avconv-streaming-3

這是實測的影片,畫面有變動的時候,影像就會出現嚴重的延遲。

使用 GStreamer 製作影像串流

另一個產生串流的方式是使用 GStreamer,由於它可以使用樹莓派的硬體進行 H.264 編碼,所以產生的串流品質會好很多。首先安裝 GStreamer:

sudo apt-get install gstreamer1.0-tools

使用 gst-launch 擷取網路攝影機的影像,產生串流:

gst-launch-1.0 -v v4l2src ! 'video/x-raw, width=640, height=480, framerate=30/1' ! queue ! videoconvert ! omxh264enc !  h264parse ! flvmux ! rtmpsink location='rtmp://localhost/rtmp/live live=1'

這是測試的畫面:

gstreamer-streaming-1

CPU 的覆載輕很多。

gstreamer-streaming-2
這是實測的影片,畫面的變動並不會影響串流影像的流暢度。

如果您對於樹莓派的應用有興趣,建議您可以繼續閱讀物聯網的相關文章。

參考資料:tpy’snginx-rtmp-module

樹莓派, 物聯網

54 留言

  1. luo

    您好我想詢問,我使用google瀏覽器,瀏覽我的樹莓派影像,但是會出現
    we are unable to connect to the network. we apologize for the inconvenience
    請協助我解出這問題

    • G. T. Wang

      client 與 server 網路設定是否正確?nginx 有裝好嗎?檢查伺服器上的 log 檔,看是否有錯誤訊息?firewall?

      • junliang

        關於顯示以下字串的解決辦法!
        we are unable to connect to the network. we apologize for the inconvenience
        我發現在網頁部分的SMTP的網址ip部分要改成當前樹梅派的ip位值!只要樹梅派改了一個ip位值那個值就要更改成當前的位址!
        在此給各位作參考

        • wuchangyu

          剛剛”按圖施工”也出現
          we are unable to connect to the network. we apologize for the inconvenience
          的錯誤訊息。
          我發現是要修改 /var/www/html/index.html 裡面
          src: “rtmp://{pi_address}/rtmp/live” 把 {pi_address} 換成板子的 ip address 就可以了。

  2. Hong

    請問一下,為何在 cd nginx
    ./configure –prefix=/var/www –sbin-path=/usr/sbin/nginx –confpath=/
    etc/nginx/nginx.conf –pid-path=/var/run/nginx.pid –error-logpath=/
    var/log/nginx/error.log –http-logpath=/
    var/log/nginx/access.log –with-http_ssl_module –withouthttp_
    proxy_module –add-module=/home/pi/nginx_src/nginx-rtmp-module,得到 bash: ./configure : No such file or directory 的回應 ?

    • G. T. Wang

      看起來是少裝了什麼東西,有先用 apt 安裝 nginx 嗎?

      • Hong

        我是個新手,所以每一步都是複製、貼上的,就是按照步驟一個一個指令貼,
        所以你有提到的步驟,我都有 check 過了。請問一下,請問要怎麼把已經安裝的東西刪光,重新安裝呢?

        • G. T. Wang

          用 apt 安裝的話,可用類似這樣的方式移除:
          apt-get purge nginx
          apt-get autoremove

          • Hong

            我在執行完 cd nginx
            ./configure –prefix=/var/www –sbin-path=/usr/sbin/nginx –confpath=/
            etc/nginx/nginx.conf –pid-path=/var/run/nginx.pid –error-logpath=/
            var/log/nginx/error.log –http-logpath=/
            var/log/nginx/access.log –with-http_ssl_module –withouthttp_
            proxy_module –add-module=/home/pi/nginx_src/nginx-rtmp-module,出現bash: ./configure : No such file or directory 的回應 。我實際進入 圖形化界面後,發現,nginx 底下沒有 configure 這個目錄或檔案,但有一個 conf 目錄,和一個 auto 目錄下有一個 叫 configure 的檔案(它是個 script 檔)。但我把 指令改成 ./conf –prefix=/var/www –sbin-path=/usr/sbin/nginx –confpath=/
            etc/nginx/nginx.conf –pid-path=/var/run/nginx.pid –error-logpath=/
            var/log/nginx/error.log –http-logpath=/
            var/log/nginx/access.log –with-http_ssl_module –withouthttp_
            proxy_module –add-module=/home/pi/nginx_src/nginx-rtmp-module 後,系統卻回應 bash: ./conf: “Is a directory”,請問一下,要如何才能解決這個問題呢???

    • zwx

      –add-module=/home/pi/nginx_src/nginx-rtmp-module,问题出在这里。po主用的是自己的路径,这里要结合你自己的nginx安装路径进行修改。

  3. 按照之前的步驟做都可以,5月多的時候
    最近SD卡故障從新再做一遍
    ./configure………..這設定編譯參數下完指令後
    就會錯誤 出現bash: ./configure : No such file or directory

  4. Hong

    請站主協助我們解決 bash: ./configure : No such file or directory 的問題,小弟感激不盡 ! ! !

  5. Hong

    站主你好,我發現 https://github.com/nginx/nginx.git
    這個網站沒有 configure 這個 shell script,
    不知道要如何解決這個問題呢 ???

    • Hong

      但我在 nginx/auto 目錄中有發現一個 configure 的 shell script ,所以我應該把 configure 從 auto 拿到 nginx 目錄,再 執行 ./configure –prefix=/var/www –sbi….. 的指令嗎 ???

  6. G. T. Wang

    我想我發現 bash: ./configure : No such file or directory 的問題出在哪裡了,應該是官方 git repository 上的原始碼處於開發階段,把 configure 這個 script 拿掉了。

    建議可以嘗試從 nginx 的官方網站下載打包好的原始碼,解壓縮後使用,我已經把步驟更新至文章中,請大家再看看還有沒有問題。

  7. Hong

    站主您好,bash: ./configure : No such file or directory 的問題已經解決了,我想再請問一個問題 : gst-launch-1.0 -v v4l2src ! ‘video/x-raw, width=640, height=480, framerate=30/1′ ! queue ! videoconvert ! omxh264enc ! h264parse ! flvmux ! rtmpsink location=’rtmp://localhost/rtmp/live live=1’
    這個 指令 要進入哪個目錄執行呢? 又 apt-get install 會把東西裝在哪個目錄下呢?

    • G. T. Wang

      gst-launch-1.0 這個指令隨便在哪裡執行都可以,apt 是系統的套件管理程式,安裝的檔案散佈在整個系統中,沒有固定在一個地方。

      我想您應該先從基礎的 Linux 系統開始學起。

  8. Hong

    站主你好,多謝您的提點( 小弟之前在IT幫發問時,也得到了相同的忠告! ),其實我是因為學校專題上有時間的壓力,需要再開學前做出些成果,所以才只能邊問邊看書,沒有很精實的從頭慢慢學起,但我有買了-鳥哥的私房菜,一本滿充實的書,等我做出一些進度後,我會從頭好好看起的。

    另外我想再請問一個問題:我執行 gst-launch-1.0…這個指令時,我的 羅技 C310 視訊攝影機,有發光(有運作時會發光),執行 lsusb 時也有讀到,但是我在瀏覽器輸入 localhost 時,卻沒有看到 C310 的串流畫面,只有看到 html 的 title: Live Streaming,瀏覽器的主畫面是一片空白。

    麻煩站主指點迷津了 ! ! !

    • G. T. Wang

      這個狀況我只能判斷是影像串流的問題,不過到底是哪個環節出問題,就要再去檢查了。

      您的處境我能理解,不過這種專案就算是照著做也需要有一定的基礎。

    • ROCK

      你好,我遇到跟您一樣的問題,請問你後來有解決嗎?

  9. Hong

    站主您好,我在 raspberry pi 上安裝了 gnash ,和 chromium,再輸入 localhost ,這時瀏覽器的主畫面有出現一個黑色的控制畫面,但仍然沒有影像輸出,這會是瀏覽器不支援播放的問題嗎???

    • Hong

      站主您好,我用我的筆電的 chrome 瀏覽器(最新版)連 raspberry pi 的串流網頁,出現:

      左上角 小長方形監視框:
      Build 1.6.328 for Flash Player 10.1
      Flash Player version: WIN 18,0,0,209
      Hardware Video Decoding: No
      Hardware Video Rendering: Yes (StageVideo 1/8)

      Frame rate: 0.00 fps Dropped frames: 0
      Buffer length / time: 0.00s/0.00s
      Memory usage: 9.24MB
      Stream state: ready

      而瀏覽器的主畫面則顯示: Error-Error#2154

      麻煩站主指點迷津了 ! ! !

      • Hong

        這個時候,我的 Nginx :
        server name:我家的對外 IP ,
        listen:80,

        rtmp {
        server {
        listen 1935;
        ping 30s;
        notify_method get;
        application rtmp {
        live on;
        }
        }
        }
        ,串流網頁 index.html 的 raspberry pi IP則是:
        src: “rtmp://localhost/rtmp/live”,

        輸入的指令是 gst-launch … rtmpsink location=’rtmp://localhost/rtmp/live live=1′

        當我把 串流網頁 index.html 的 raspberry pi IP 從 localhost 改成 我家的對外IP,
        用筆電連的時候會出現: We are unable to connect to the network. We apologize for the inconvenience. ,

        若 串流網頁 index.html 的 raspberry pi IP 是 localhost,
        輸入的指令改成 gst-launch … rtmpsink location=’rtmp://我家對外IP/rtmp/live live=1′
        ,則會出現錯誤: couldn’t connect to rtmpsink location=’rtmp://我家對外IP/rtmp/live live=1’,

        麻煩站主了 !!!

  10. Hong

    站主您好,我改用 avconv 的方式,仍然不行,瀏覽器一樣會出現 error #2154,我上網查過,error #2154 似乎跟 adobe 有關,似乎跟 Strobe Media Playback 有關,我的筆電是 win 7,然後是用 Raspberry pi 2,麻煩站主指點迷津,小弟不勝感激!!!

  11. Hong

    站主您好,我把 index.html 的 raspberry pi IP address (從 localhost or 127.0.0.1 ) 改成 192.168.0.104 (我的 IP 分享器下 Raspberry pi 的 IP address),以及把 gst-launch-1.0 … location=’rtmp://localhost/rtmp/live live=1′ 的localhost 改成 192.168.0.104 之後,我用我的筆電連 Raspberry pi 的網頁就連得上且看得到串流畫面了,雖然不知為何我在 Raspberry pi 上仍然看不到 串流畫面,我想應該是 我在 pi 上面裝的 gnash 不支援播放吧 !!! 無論如何都要感謝站主的幫忙,希望之後還能請教您問題,感謝感謝 !!!

  12. JohnWang

    站主, 以及看到此訊息的各位,
    請問~你們的RTMP server (Raspberry PI上),
    串流會偶爾斷線嗎?

    我的會串個幾十分鐘或1hr後,斷個幾秒,又恢復,
    又過一陣子,又斷個幾秒,又恢復…

    你們會這樣嗎??
    應該可以排除是頻寬問題,因為我是在LAN,而且我打的流bit rate很小.

  13. Jeremy

    站主您好,若我想加入音頻的串流,該如何增添avconv參數?

    • G. T. Wang

      這個部份目前我實在抽不出時間研究,建議去 Google 搜尋,網路上似乎有一些資訊。

  14. 泥嚎~
    我在使用gst-launch的時候遇到如下錯誤…

    WARNING: erroneous pipeline: no element “v4l2src”

    请问博主知道怎样解决嘛~谢谢了

  15. Well

    妳好想詢問一下 為什麼 編輯 /etc/nginx/nginx.conf 設定檔的時候
    這個檔案 不能做更改的動作 所以沒辦法貼上
    rtmp {
    server {
    listen 1935;
    ping 30s;
    notify_method get;
    application rtmp {
    live on;
    }
    }
    }
    不知道有沒有什麼解決方法,謝謝

    • G. T. Wang

      請從基本的 Linux 觀念學起。

  16. Well

    想請問一下
    sudo service nginx start打下去之後
    卻沒有發生任何的反應
    沒有顯示錯誤 也沒有成功
    結果後來串流後 卻沒辦法顯示網頁
    能否詢問一下哪邊有錯誤 謝謝

  17. Well

    nginx.service access denied
    出現這個狀況 該怎麼處理呢
    上網查過很多文章也是沒辦法

  18. 66

    不好意思請教一下
    執行sudo service nginx start後

    出現
    Job for nginx.service failed. See ‘systemctl status nginx.service’ and ‘journalctl -xn’ for details.

    我應該如何解決或是用什麼關鍵字來搜尋

  19. 66

    我嘗試了 service nginx configtest
    顯示
    [FAIL] Testing nginx configuration: failed!

  20. 66

    你好,我發現是因為VNC SERVER的問題
    REBOOT後就好了

    • DD

      想請問你的問題是如何解決的呢?
      我們也是相同的問題!
      謝謝!

  21. 彤彤

    gst-launch-1.0 -v v4l2src ….
    在這一行指令碼上面,由於不懂GStream,不過我根據我的設備更改了寬、高(網路攝影機設備是1080p,把寬高跟頻率分別改為1920,1080, 60/1)
    但出現了ERROR
    ERROR:Pipeline doesn’t want to pause
    ERROR:from element /GstPipeline:pipeline0/GstV4l2Src0: Cannot identify device ‘/dev/video0’
    請樓主指點迷津了

  22. recluse

    幫樓主補充少少, “sudo apt-get install gstreamer1.0-tools” 不太夠, 會遇到 no element “v4l2src” 和 no element “omxh264enc”.

    這是由於很多library在別的package, 參考了 http://theiopage.blogspot.hk/2013/04/enabling-hardware-h264-encoding-with.html

    再安裝多一句
    sudo apt-get install libgstreamer1.0-0 libgstreamer1.0-0-dbg libgstreamer1.0-dev liborc-0.4-0 liborc-0.4-0-dbg liborc-0.4-dev liborc-0.4-doc gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-doc gstreamer1.0-omx gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-dbg gstreamer1.0-plugins-bad-doc gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg gstreamer1.0-plugins-good-doc gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg gstreamer1.0-plugins-ugly-doc gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev

    • 王文旋

      hello:
      我按照您提供的依赖包,在Ubuntu系统里下载了最新的依赖,但是出现找不到“gstreamer1.0-omx”这个依赖包,这个能请教下是什么原因吗?(双显卡电脑,虚拟机中安装了Ubuntu 16.04的系统)

  23. recluse

    另外, 再補充多一點,
    不太知道原因, 安裝完上面所說的library後,
    我遇到了Could not connect to RTMP stream “rtmp://localhost/rtmp/live live=1” for writing

    參考了, https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp

    加了
    location /stat {
    rtmp_stat all;
    rtmp_stat_stylesheet stat.xsl;
    }
    location /stat.xsl {
    # you can move stat.xsl to a different location
    root /usr/build/nginx-rtmp-module;
    }

    # rtmp control
    location /control {
    rtmp_control all;
    }

    在http server裡面, 再restart nginx.
    去了http:///stat 看一看後, 再試一次就sink到了…. 有點奇怪….也不太知道之前失敗的原因….

    sink到之後, 初初去index.html也看不到甚麼….不知是不是chrome有cache還是其他原因, 在desktop試用vlc去rtmp:///rtmp/live看看, 等了一會才有畫面(可能是我用的pi 1 model b+ 比較慢)

    再回到chrome refresh, Strobe Media Playback終於出現了.

    多謝樓主教學, GStreamer真的不錯

    • G. T. Wang

      感謝您的補充資料。 🙂

  24. HU

    對不起我是個新手 我照著順序做 並沒有在/var/www/html/index.html的地方看到index.html 是我哪裡有問題嗎?

    • G. T. Wang

      若沒有就自己新增一個。

  25. Peter Liu

    Wang 大:

    一直有在訂閱您的網誌,最近想架一個服務,像是實況主轉撥的功能。使用狀況如下:

    台北會議現場–Android手機—上傳LiveStream—Server(日本)—高雄辦公室

    這樣同事到台北開會時,南部在辦公室的其他員工,也能線上看到轉撥。
    請問有何高見?或類似接觸過的解法(Solution)

    • G. T. Wang

      我是沒有架設過類似的伺服器,因為自己架設伺服器的成本太高了,通常都直接打 Skype 視訊解決。

  26. Relyn

    我通過Gstreamer推送rtmp串流到大陸的鬥魚直播平臺,但沒有聲音,Google也找不到網路上的配置音頻串流的方法,望博主有空指點迷津。

  27. Leo

    您好,我要使用avconv製作影片串流,前面都照著步驟完成,html內改成樹梅派的ip,但瀏覽器輸入ip時是一片空白,只有title呈現Live Streaming,之前我有執行avconv -f video4linux2 -r 24 -i /dev/video0 -f flv rtmp://localhost:1935/rtmp/live,那空白的原因是我nginx 伺服器沒架好,還是網路的問題

  28. 王文旋

    Hi :

    按照博主的方法,我在centos系统的上架设了nginx+nginx-rtmp-module服务器,发现centos系统是无法进行avconv软解的;然后使用gstreamer1.0-tools时,视频数据流传送不到vlc播放器上,配置的话在Ubuntu上已经试过很多次了,请教下大家有遇到过此类问题吗?

  29. sun

    [video4linux2,v4l2 @ 0x54f6baa0] The driver changed the time per frame from 1/24 to 1/9
    Input #0, video4linux2,v4l2, from ‘/dev/video0’:
    Duration: N/A, start: 7413.448948, bitrate: 132710 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280×720, 132710 kb/s, 9 fps, 9 tbr, 1000k tbn, 1000k tbc
    rtmp://127.0.0.1/rtmp/live: Input/output error
    这种问题是为什么呀

  30. Ke

    最近使用Gstreamer影像串流,不知道怎麼將gstreamer停止,所以將terminal直接關閉,結果導致/dev/video0持續運作,相機一直在開啟狀態,將raspberry pi 重新啟動也無法改善這問題,以至於我執行gstreamer時都會產生/dev/video0 is busy 請問要怎麼將/dev/video0停止運作

  31. kyc1109

    錯誤:來自 /GstPipeline:pipeline0/GstRTMPSink:rtmpsink0 element:無法開啟寫入用的資源。 could not open resource for writing
    額外偵錯資訊:
    gstrtmpsink.c(245): gst_rtmp_sink_render (): /GstPipeline:pipeline0/GstRTMPSink:rtmpsink0:

    補充一下,遇到上面所述的問題,是因為nginx.conf的設定和rtmp的串流沒有一致,用After就OK了,我搞了好久阿。
    Before:
    avconv -f video4linux2 -r 24 -i /dev/video0 -f flv rtmp://192.168.1.29:1935/rtmp/live
    After (remove /rtmp, that is work)
    avconv -f video4linux2 -r 24 -i /dev/video0 -f flv rtmp://192.168.1.29:1935/live

  32. 村銘

    請問在沒有網路的情況下,
    使用樹莓派+pi camera
    透過WIFI 傳輸到手機顯示
    要使用何種軟體呢?

  33. Kevin

    版主,您好!我執行到”編譯與安裝nginx的動作”
    make
    sudo make install
    發現有很多error,請問有相關解法嗎?
    前面的步驟都也成功

Comments are Closed