FFMPeg
Open Source 的 Command Line 轉影音檔軟體
(預設不支援 rmvb 與 rm)
ffmpeg-doc.html

本人目前已經可以實現在線將所有格式轉FLV,不是本地操作,是在服務器上轉哦。不過要用兩個軟件來轉,雖然

比較麻煩,但是已經實驗成功,重要的是完全免費,詳情請點擊以下鏈接,不是發廣告貼,請各版主支持。
http://www.jiaotacn.com/index.asp?boardid=15



先從Mencoder這個開始,將所有格式轉AVI,

RMVB轉AVI


mencoder 1.rmvb -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o rmvb.avi

RM轉AVI

mencoder 1.rm -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o rm.avi

MPEG轉AVI

mencoder mp4.mpeg -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o mp4.avi

MOV轉AVI

mencoder qtime.mov -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o qtime.avi

WMV轉AVI 包括WMV7到WMV9,只實驗到WMV9

mencoder m7.wmv -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o m7.avi

RV轉AVI

mencoder 1.rv -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o rv.avi

等等……格式,參數不變,改檔案名就好了。這裡參數是什麼意思,我目前還不懂,學習中,你可以在網上找找,找到告訴我啊,謝謝。

接下來是FFMPEG上場。

AVI轉FLV

ffmpeg -i test.avi -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 test.flv

抓圖JPG。

ffmpeg -i 2.wmv -y -f image2 -ss 8 -t 0.001 -s 350x240 test.jpg

線上播放 flv

mencoder
另一轉檔程式,支援 rmvb 與 rm 系列


指令用法(隨時補充)

抓 mms 的串流
QUOTE
mencoder mms://wmt-od.stream.ne.jp/ntv/hkzkt/hkzkt10.wmv -o hkzkt10.wmv -ovc copy -oac copy

同上,使用 Mplayer 抓串流改善影音不同步問題
(因為有時使用 mencoder 抓會影音不同�cool.gif
CODE
mplayer -dumpstream [你的連結] -dumpfile [輸出檔名]
這樣也可以喔,而且影音可以同步


批次壓 avi 檔案成為 MPEG4格式
CODE
#!/bin/sh

for i in *.AVI
do
mencoder -ovc lavc -lavcopts vcodec=mpeg4 -flip -oac copy $i -o \
`basename $i .AVI`-MPEG4.avi
done

ps:-sub ????.srt 加字幕

整片 DVD 不壓, 保持原品質, Copy 成一個檔案 (二小時, 約 4G)
CODE
mencoder -o 檔名 -ovc copy -oac copy -dvd 1 -dvd-device /dev/hdc


將MMS 串流的 WMA 格式音樂轉成 MP3
CODE
mplayer -ao pcm mms://192.168.38.49/music.wma
lame -h audiodump.wav music.mp3

抓 wav 檔案
QUOTE
mplayer -ao pcm http://192.168.38.49/music.wav

3GP轉FLV
CODE

mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok\1.3gp -o ok\3gp.flv

MOV轉FLV
CODE

mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok\qtime.mov -o ok\mov.flv

RMVB轉FLV
CODE

mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok\1.rmvb -o ok\rmvb.flv

WMV轉FLV
CODE

mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok\m9.wmv -o ok\m9.flv

CentOS 4.2 安裝 MPlayer 後要使用指令出現錯誤
QUOTE
MPlayer was compiled without libmp3lame support.
-lameopts is not an MEncoder option

MP3 解碼

將 libmp3lame 編譯進 mencoder 的教學

./mencoder -o test.flv -ovc lavc -oac lavc test.mpg

將mpg 轉為 flv 不帶其他參數

−oac <編解碼器名稱>

用給定的音頻編解碼器編碼 (沒有默認的設置)。
注意: 用 −oac help 顯示可用的音頻編解碼器列表。

示例:

−oac copy

不編碼, 僅僅流拷貝

−oac pcm

編碼到無壓縮的 PCM。

−oac mp3lame

編碼到 MP3 (使用 LAME)。

−oac lavc

用 libavcodec 編解碼器編碼。

−of <格式> (BETA 代碼!)

編碼到指定的容器格式 (默認是: AVI)。
注意: 用 −of help 顯示可用的容器格式列表。

示例:

−of avi

編碼到 AVI。

−of mpeg

編碼到 MPEG (也請參見 −mpegopts)。

−of lavf

用 libavformat 合路器編碼 (也請參見 −lavfopts)。

−of rawvideo

原始(raw)視頻流 (不用合路 − 僅一個視頻流)

−of rawaudio

原始(raw)音頻流 (不用合路 − 僅一個音頻流)

mencoder 影音同步

14.1.9. Notes on Audio/Video synchronization

MEncoder's audio/video synchronization algorithms were designed with the intention of recovering files with broken sync. However, in some cases they can cause unnecessary skipping and duplication of frames, and possibly slight A/V desync, when used with proper input (of course, A/V sync issues apply only if you process or copy the audio track while transcoding the video, which is strongly encouraged). Therefore, you may have to switch to basic A/V sync with the -mc 0 option, or put this in your ~/.mplayer/mencoder config file, as long as you are only working with good sources (DVD, TV capture, high quality MPEG-4 rips, etc) and not broken ASF/RM/MOV files.

If you want to further guard against strange frame skips and duplication, you can use both -mc 0 and -noskip. This will prevent all A/V sync, and copy frames one-to-one, so you cannot use it if you will be using any filters that unpredictably add or drop frames, or if your input file has variable framerate! Therefore, using -noskip is not in general recommended.

The so-called "three-pass" audio encoding which MEncoder supports has been reported to cause A/V desync. This will definitely happen if it is used in conjunction with certain filters, therefore, it is now recommended not to use three-pass audio mode. This feature is only left for compatibility purposes and for expert users who understand when it is safe to use and when it is not. If you have never heard of three-pass mode before, forget that we even mentioned it!

There have also been reports of A/V desync when encoding from stdin with MEncoder. Do not do this! Always use a file or CD/DVD/etc device as input.

所有的 codes
arrow
arrow
    全站熱搜

    kevin0523 發表在 痞客邦 留言(0) 人氣()