2009-11-19 87 views
6

編輯
我停止使用VLC並切換到GMax FLV Encoder。它在IMO方面做得更好。VLC桌面流媒體

原帖
我送我的桌面(屏幕)作爲H264視頻流到另一臺機器,使用follwoing命令行保存到一個文件:

流的發件人:

vlc -I dummy 
    --sout='#transcode{vcodec=h264,vb=512,scale=0.5} 
      :rtp{mux=ts,dst=192.168.0.1,port=4444}' 

接收機流的:

vlc -I rc 
    rtp://@:4444 
    --sout='#std{access=file,mux=ps,dst=/home/user/output.mp4}' 
    --ipv4 

這工作,但噸這裏有幾個問題:

  • 該文件不適用於大多數玩家。
  • VLC能夠回放文件,但有一些奇怪:
  • =>回放實際開始前大約需要10秒。
  • =>尋找不起作用。

有人能指出我如何解決這些問題的正確方向嗎?

編輯:我取得了一些進展。

播放的初始延遲是因爲播放器正在等待關鍵幀。通過迫使流的發送者創建一個新的關鍵幀每4秒,我可以降低延遲:

:screen-fps=10 
--sout='#transcode{vcodec=h264,venc=x264{keyint=40},vb=512,scale=0.5} 
     :rtp{mux=ts,dst=192.168.0.1,port=4444}' 

的尋租問題不解決然而,但我知道它好一點。 RTP流以其原始流格式保存爲文件,通常無法將其作爲常規視頻文件播放。 VLC設法播放這個文件,但大多數其他播放器不會。所以我需要把它轉換成一個普通的視頻文件。我目前正在調查是否可以用ffmpeg做到這一點,如果我爲它提供SDP文件的記錄流。

歡迎所有幫助!

+0

我不知道如何回答這個問題,但你嘗試使用視頻編輯器和文件保存爲不同格式? – Mottie 2009-11-21 12:28:27

+0

是的,用ffmpeg我試圖修復,但它似乎將整個輸出減少到幾幀,所以我結束了1秒的視頻。 – StackedCrooked 2009-11-21 14:50:14

+1

這個編程如何相關? – 2009-11-21 22:37:57

回答

6

更新您發送命令符合:

venc=x264{scenecut=20,bframes=0} 

和你的客戶命令行:

vlc -I rc rtp://@:4444 --sout='#std{access=file,mux=mp4,dst=/tmp/output.mp4}' --ipv4 

應該可以解決你的問題。你測試了哪些球員?

+0

設置mux = mp4確實有幫助,可惜它沒有提到文檔(http://www.videolan.org/doc/streaming-howto/en/ch03.html)。 今天我發現設置bframes = 0會導致一個可以用ffmpeg修復的文件,但現在由於mux = mp4的設置,這也不再需要了。 但是,scenecut = 20如何幫助解決我的問題?或者它只是一個優化? – StackedCrooked 2009-11-21 23:16:17

+0

還有一個問題:爲什麼你忽略了x264的keyint = 40設置? – StackedCrooked 2009-11-21 23:22:44

+0

順便說一句,我測試了我的Mint vbox上的Movie Player和GNOME Player。這些都可以播放我的錄音,這要感謝您提供的設置。 PS:回答上述問題,賞金是你的。 – StackedCrooked 2009-11-21 23:28:41

0

發件人:

$ vlc screen:// :screen-fps=5 :screen-caching=100 --sout='#transcode{vcodec=h264,venc=x264{scenecut=20,bframes=0},vb=512,scale=0.5}:rtp{mux=ts,dst=127.0.0.1,port=1234}' 
VLC media player 1.1.11 The Luggage (revision exported) 
Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS") 
Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE") 
[0x9caf8fc] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. 
Blocked: call to setlocale(6, "") 
Warning: call to srand(1314435080) 
Warning: call to rand() 
Blocked: call to setlocale(6, "") 

(process:11597): Gtk-WARNING **: Locale not supported by C library. 
    Using the fallback 'C' locale. 
x264 [info]: using cpu capabilities: MMX2 Cache64 
x264 [info]: profile High, level 3.2 
x264 [info]: using SAR=1/1 
x264 [info]: using cpu capabilities: MMX2 Cache64 
x264 [info]: profile High, level 4.0 
x264 [info]: frame I:1  Avg QP:16.44 size: 57235 
x264 [info]: frame P:152 Avg QP:10.01 size: 2747 
x264 [info]: mb I I16..4: 33.8% 2.7% 63.5% 
x264 [info]: mb P I16..4: 0.9% 0.0% 0.9% P16..4: 2.1% 0.4% 0.3% 0.0% 0.0% skip:95.4% 
x264 [info]: 8x8 transform intra:1.8% inter:44.3% 
x264 [info]: coded y,uvDC,uvAC intra: 45.5% 42.9% 40.5% inter: 1.5% 1.5% 1.4% 
x264 [info]: i16 v,h,dc,p: 45% 54% 0% 0% 
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 41% 22% 2% 2% 2% 4% 1% 3% 
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 49% 13% 2% 3% 3% 5% 2% 7% 
x264 [info]: i8c dc,h,v,p: 43% 49% 7% 2% 
x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0% 
x264 [info]: ref P L0: 85.8% 4.5% 9.1% 0.7% 
x264 [info]: kb/s:124.12 
^C[0x9d4ee6c] signals interface error: Caught Interrupt signal, exiting... 

接收機:

$ vlc udp://:1234 
VLC media player 1.1.11 The Luggage (revision exported) 
Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS") 
Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE") 
[0x8c728fc] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. 
Blocked: call to setlocale(6, "") 
Warning: call to srand(1314469032) 
Warning: call to rand() 
Blocked: call to setlocale(6, "") 

(process:11707): Gtk-WARNING **: Locale not supported by C library. 
    Using the fallback 'C' locale. 
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 6, expected 5) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 10, expected 9) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 14, expected 13) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 1) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 12, expected 11) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 14, expected 13) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 15) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 2, expected 1) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 7, expected 6) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 9, expected 8) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 11, expected 10) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 12) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 15, expected 14) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 1, expected 0) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 11, expected 10) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 13, expected 12) for PID 66 
libdvbpsi error (PSI decoder): TS discontinuity (received 4, expected 3) for PID 0 
libdvbpsi error (PSI decoder): TS discontinuity (received 8, expected 7) for PID 66 
[0xb740070c] main input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) 
^C[0x8d11cec] signals interface error: Caught Interrupt signal, exiting...