2016-08-28 83 views
0

我有一個pcm音頻文件,我想通過rtp流。當我做Gstreamer。 PCM流

gst-launch-1.0 filesrc location=AudioRaw515151.pcm ! audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=8000 ! alawenc ! rtppcmapay ! udpsink host=192.168.2.5 port=5010 

我有那樣的消息

Pipeline is PREROLLING ... 
Pipeline is PREROLLED ... 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 
Got EOS from element "pipeline0". 
Execution ended after 0:00:00.019270487 
Setting pipeline to PAUSED ... 
Setting pipeline to READY ... 
Setting pipeline to NULL ... 
Freeing pipeline ... 

,但我可以播放音頻,這意味着,音頻正常。

gst-launch-1.0 filesrc location=AudioRaw515151.pcm ! audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=8000 ! alawenc ! rtppcmapay ! rtppcmdepay ! alawdec ! audiosink 

我試圖把另一個文件,avi文件,採取音頻從它和maked同樣的事情

gst-launch-1.0 filesrc location=file.avi^
    ! qtdemux name=mux^ 
    ! queue^
    ! faad^
    ! audioconvert^
    ! audioresample^
    ! "audio/x-raw, layout=(string)interleaved, rate=(int)8000"^
    ! alawenc^
    ! rtppcmapay^
     ! queue^
     ! udpsink host=192.168.2.5 port=5010 

正如你看到的,這同樣的事情,但與AVI有聲。一切正常。

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
Pipeline is PREROLLED ... 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 

當我打開Wireshark的我看到,當我跑我與PCM管道,它觸發所有的數據沒有任何延遲,並在我發送的每個數據包是:

Header checksum: 0x0000 [incorrect, should be 0x40b5 (may be caused by "IP checksum offload"?)] 
Message: Bad checksum 

所以這是一個問題。我認爲我有時間戳或類似的問題,當我做!alawenc(編碼爲G711)時,我說得對? 什麼解決方案可以解決這個問題?

+0

我有接收視頻,但沒有音頻我錯過? –

回答

1

第一個問題。第二個例子玩嗎?

一些更多的評論:

  • file.avi和qtdemux聽起來錯,只是用decodebin(或uridecodebin)離開pligging到GStreamer的。
  • 原始音頻我建議使用audioparse元素

最後還有在GIT回購一堆RTP例子: https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/client-PCMA.sh

+0

>>第一個問題。第二個例子玩嗎?是的 謝謝。現在試試 –

+0

我發現:filesrc會以給定的文件讀取數據作爲原始字節;我不能只用alawenc編碼這些原始字節。因此,我在文件src後添加!audioparse,並且輸出爲 'ERROR:from element/GstPipeline:pipeline0/GstAudioParse:audioparse0:內部數據流錯誤。 其他調試信息: gstrawparse.c(471):gst_raw_parse_loop():/ GstPipeline:pipeline0/GstAudioParse:audioparse0' –

+0

謝謝。一切正常。 –