2012-10-18 190 views
3

我想通過RTSP使用ffserver流媒體到目前爲止沒有運氣mp4文件。我只是想直接從文件流,而不從ffmpeg饋送(不涉及代碼轉換)。但我已經使它與mpg視頻一起工作。通過RTSP與ffserver流MP4文件

這裏是我的ffserver的配置文件

Port 8090 
BindAddress 0.0.0.0 
MaxHTTPConnections 2000 
MaxClients 1000 
MaxBandwidth 500000 
CustomLog - 
NoDaemon 

RTSPPort 7654 
RTSPBindAddress 0.0.0.0 

<Stream test1-rtsp> 
    Format rtp 
    File "/home/g/video_streaming/sample3-mpeg2.mpg" 
</Stream> 
<Stream test2-rtsp> 
    Format rtp 
    File "/home/g/video.mp4" 
</Stream> 

當我啓動ffserver的,一切似乎罰款基於日誌輸出:

$ ./dev/ffmpeg/ffserver -f ffserver-sample.conf 
ffserver version N-45673-gd0c27e8 Copyright (c) 2000-2012 the FFmpeg developers 
    built on Oct 18 2012 10:36:52 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
    configuration: 
    libavutil  51. 76.100/51. 76.100 
    libavcodec  54. 66.100/54. 66.100 
    libavformat 54. 33.100/54. 33.100 
    libavdevice 54. 3.100/54. 3.100 
    libavfilter  3. 19.103/3. 19.103 
    libswscale  2. 1.101/2. 1.101 
    libswresample 0. 16.100/0. 16.100 
Thu Oct 18 11:54:22 2012 Opening file '/home/g/video.mp4' 
Thu Oct 18 11:54:22 2012 Opening file '/home/g/video.mp4' 
Thu Oct 18 11:54:23 2012 Opening file '/home/g/video_streaming/sample3-mpeg2.mpg' 
Thu Oct 18 11:54:23 2012 [mpeg @ 0x1dae3c0]max_analyze_duration 5000000 reached at 5005000 
Thu Oct 18 11:54:23 2012 Opening file '/home/g/video_streaming/sample3-mpeg2.mpg' 
Thu Oct 18 11:54:23 2012 [mpeg @ 0x1dae3c0]max_analyze_duration 5000000 reached at 5005000 
Thu Oct 18 11:54:23 2012 FFserver started. 

最後,如果我爲了測試服務器運行ffplay ,一切工作正常的MPG文件,但不適用於MP4:

$ ffplay rtsp://192.168.1.99:7654/test2-rtsp 
ffplay version N-45656-g916352f Copyright (c) 2003-2012 the FFmpeg developers 
    built on Oct 17 2012 16:14:14 with gcc 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5.1) 
    configuration: 
    libavutil  51. 76.100/51. 76.100 
    libavcodec  54. 66.100/54. 66.100 
    libavformat 54. 33.100/54. 33.100 
    libavdevice 54. 3.100/54. 3.100 
    libavfilter  3. 19.103/3. 19.103 
    libswscale  2. 1.101/2. 1.101 
    libswresample 0. 16.100/0. 16.100 
rtsp://192.168.1.99:7654/test2-rtsp: Invalid data found when processing input 

Server's output: 

Thu Oct 18 11:57:51 2012 FFserver started. 
Thu Oct 18 11:58:01 2012 192.168.1.101 - - [DESCRIBE] "rtsp://192.168.1.99:7654/test2-rtsp RTSP/1.0" 200 167 
Segmentation fault (core dumped) 

我不真實我知道我可能會錯過什麼。我剛剛讀了in the official doc,表示從一個文件流式傳輸是有點破碎。由於我不知道這是否是最新的,我決定在這裏嘗試一下。

任何幫助或建議?備擇方案?

在先進的感謝,

回答

1

如果您正在尋找替代LIVE555(http://www.live555.com/)和達爾文服務器都是不錯的選擇。我已經使用了它們,並且在從文件流中傳輸時表現良好。

在上述情況下,您甚至可以通過分析核心轉儲來嘗試調試。通過查看日誌,我認爲服務器即使在收到播放命令之前也會崩潰。因此,它可能是一個小的鄉下人,某處

+1

鳳也不錯。至少比ffserver好多了。 – vipw

0

只有4年後...

使用ffserver的,因爲它包含在文件頭全局元數據,因此無法串流MP4視頻 - 製作隨機流訪問不可能。 [source]

可能的替代:

// convert awesome.mp4 to awesome.flv 

$ ffmpeg -i awesome.mp4 -c:v libx264 -ar 22050 -crf 28 awesome.flv 

更多關於FFmpeg的...去blog