LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2539|回复: 7

安装mplayer+ffmpeg-mt+CorAVC 2.0成功,发帖纪念!

[复制链接]
发表于 2011-2-6 11:21:54 | 显示全部楼层 |阅读模式
一直苦于mplayer的威力不能完全发挥,在播放高码率bluray的吃力,mencoder支持的库太少,压制片子时找不到合用的库。趁着七天长假,一狠心,从官网上下了最新的mplayer-1.0-rc4和ffmpeg-mt,经过三天的苦心琢磨,编译成功使用的mencoder一组



编译成功带CoreAVC 2.0和ffmpeg-mt加速的mplayer一组作为主力播放器,编译成功只带CoreAVC 2.0加速的mplayer一组和只带ffmpeg-mt加速的mplayer各一组作为备用播放器。经测试,在开启多核加速选项后能够轻松播放以前放不流畅的1080P了,开心!
安装CoreAVC和集成ffmpeg-mt时出了太多问题,经过N次调整和重新编译,终于达到相对理想的效果,最辛苦的是我和CPU了,来回编译 mplayer和ffmpeg-mt二十多次。。。。真是痛苦。。。还好CPU比以前的C366快多啦,好歹也是双核啦 。。。
一、需要的东西
mplayer-1.0rc4( 稳定,看bluray iso不能正常加载字幕)
mpalyer-svn     (新特性多看bluray可以加载字幕)
libx264             (ffmpeg-mt需要,要先于ffmpeg-mt安装)
libva                    (ffmpeg-mt硬件加速库,libx264后安装)
libswscale          (ffmpeg-mt需要,默认的git  ffmeg-mt不带此库,需要单独下载)
二、安装中主要注意几点:
1、ffmpeg-mt可以用两种方式加载进mplayer,静态和动态
2、静态方式就是把ffmpeg-mt的代码整体进mplayer,同步编译。目前只在mpayer-svn上编译成功,mplayer-1.0rc4失败。新下载的mplayer-svn不带ffmpeg库,需要将ffmpeg-mt复制进去,改名为ffmpeg即可,然后按照正式步聚配置mplayer,编译既可。ffmpeg不要配置,我是配置并单独编译ffmpeg成功,但是mplayer死活就编译不过了。libswscale也要一并复制到ffmpeg和mplayer-svn目录中。
3、动态方式把ffmpeg-mt单独编译安装,生成liba*的动态链接库,供mplayer调用。
./configure --enable-gpl  --enable-shared --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-x11grab --disable-vdpau --enable-libfaac --enable-libmp3lame  --enable-libx264 --enable-libfaac --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libxvid
4、mplayer-1.0rc4调用时只要在配置文件中禁用ffmpeg的静态编译就可以了
./configure --prefix=/usr --enable-gui --codecsdir=/usr/lib/codecs --enable-joystick --enable-menu --enable-xvmc  --disable-vdpau  --disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a  --disable-libswscale_a  
5、mplayer-svn调用时只要在配置文件中增加一句--disable-ffmpeg_a就可以了
6、单独编译生成的ffmpeg-mt动态库安装路径要在ld.so.conf中并执行ldconfig才能让动态加载的mplayer找得到,否则就报错
7、单独编译生成的ffmpeg-mt动态库对mplayer静态方式安装有影响,需要将单独编译生成的ffmpeg-mt动态库移走并重新ldconfig才能防止mplayer在静态方式下加载这些库造成编译错误。
8、CoreAVC采用最新的SVN补丁可以正确在mplayer-1.0rc4上应用,对mplayer-svn部分有效,需要手动修正

$mencoder -oac help
MEncoder SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team

Available codecs:
   copy     - frame copy, without re-encoding (useful for AC3)
   pcm      - uncompressed PCM audio
   mp3lame  - cbr/abr/vbr MP3 using libmp3lame
   lavc     - FFmpeg audio encoder (MP2, AC3, ...)
   faac     - FAAC AAC audio encoder

mencoder -ovc help
MEncoder SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team

Available codecs:
   copy     - frame copy, without re-encoding. Doesn't work with filters.
   frameno  - special audio-only file for 3-pass encoding, see DOCS.
   raw      - uncompressed video. Use fourcc option to set format explicitly.
   lavc     - libavcodec codecs - best quality!
   vfw      - VfW DLLs, read DOCS/HTML/en/encoding-guide.html.
   qtvideo  - QuickTime DLLs, currently only SVQ1/3 are supported.
   xvid     - XviD encoding
   x264     - H.264 encoding

~/mp_pre/mplayer
MPlayer 1.0rc4-4.3.0 (C) 2000-2010 MPlayer Team
161 audio & 352 video codecs
Usage:   mplayer [options] [url|path/]filename

Basic options: (complete list in the man page)
-vo <drv>        select video output driver ('-vo help' for a list)
-ao <drv>        select audio output driver ('-ao help' for a list)
vcd://<trackno>  play (S)VCD (Super Video CD) track (raw device, no mount)
dvd://<titleno>  play DVD title from device instead of plain file
-alang/-slang    select DVD audio/subtitle language (by 2-char country code)
-ss <position>   seek to given (seconds or hh:mm:ss) position
-nosound         do not play sound
-fs              fullscreen playback (or -vm, -zoom, details in the man page)
-x <x> -y <y>    set display resolution (for use with -vm or -zoom)
-sub <file>      specify subtitle file to use (also see -subfps, -subdelay)
-playlist <file> specify playlist file
-vid x -aid y    select video (x) and audio (y) stream to play
-fps x -srate y  change video (x fps) and audio (y Hz) rate
-pp <quality>    enable postprocessing filter (details in the man page)
-framedrop       enable frame dropping (for slow machines)

Basic keys: (complete list in the man page, also check input.conf)
<-  or  ->       seek backward/forward 10 seconds
down or up       seek backward/forward  1 minute
pgdown or pgup   seek backward/forward 10 minutes
< or >           step backward/forward in playlist
p or SPACE       pause movie (press any key to continue)
q or ESC         stop playing and quit program
+ or -           adjust audio delay by +/- 0.1 second
o                cycle OSD mode:  none / seekbar / seekbar + timer
* or /           increase or decrease PCM volume
x or z           adjust subtitle delay by +/- 0.1 second
r or t           adjust subtitle position up/down, also see -vf expand

* * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *
发表于 2011-2-6 14:05:11 | 显示全部楼层
汗...折腾完了你还跑来发纪念帖...
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-2-6 20:46:31 | 显示全部楼层
bluray测试,开启ffmpg-mt多核支持,否则就声画不同步


mplayer -demuxer lavf -lavdopts threads=2 br:////mnt/ht/hdtv/hdmv/"Tsai.Chin.HK.Concert. Live.2010.BluRay.1080i.AVC.LPCM.TrueHD.DTS-HD.HR5.1-CHDBits"
MPlayer SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team
161 audio & 352 video codecs
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing br:////mnt/ht/hdtv/hdmv/Tsai.Chin.HK.Concert. Live.2010.BluRay.1080i.AVC.LPCM.TrueHD.DTS-HD.HR5.1-CHDBits.
libavformat file format detected.
[mpegts @ 0xaac8e10] max_analyze_duration reached
[NULL @ 0xab083d0] start time is not set in av_estimate_timings_from_pts
[NULL @ 0xab0a1e0] start time is not set in av_estimate_timings_from_pts
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (pcm_bluray), -aid 0
[lavf] stream 2: audio (truehd), -aid 1
[lavf] stream 3: audio (ac3), -aid 2
[lavf] stream 4: audio (dca), -aid 3
[lavf] stream 5: audio (ac3), -aid 4
[lavf] stream 6: subtitle (pgssub), -sid 0
[lavf] stream 7: subtitle (pgssub), -sid 1
LAVF: Program 1
VIDEO:  [H264]  1920x1080  0bpp  29.970 fps    0.0 kbps ( 0.0 kbyte/s)
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [dshowserver] DirectShowServer video codecs
[PP] Using codec's postprocessing, max q = 4.
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [gl] 1920x1080 => 1920x1080 Planar YV12
mmap: Bad file descriptor
VDecoder init failed
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 6 ch, s16le, 4608.0 kbit/100.00% (ratio: 576000->576000)
Selected audio codec: [fflpcm] afm: ffmpeg (Blu-ray LPCM)
==========================================================================
AO: [alsa] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [gl] 1920x1080 => 1920x1080 Planar YV12
A: 603.6 V: 603.6 A-V:  0.000 ct:  0.000   0/  0 16% 14%  3.6% 0 0 $<50>
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-2-6 20:55:52 | 显示全部楼层
CoreAVC测试

mplayer -demuxer mkv Black*.mkv
MPlayer SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team
161 audio & 352 video codecs
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing Black.Hawk.Down.2001.BluRay.1080p.DTS.2Audio.x264-CHD.mkv.
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC) "Black.Hawk.Down.2001", -vid 0
[mkv] Track ID 2: audio (A_DTS) "DTS-5.1CH 1536K(From LPCM5.1)", -aid 0, -alang eng
[mkv] Track ID 3: audio (A_AC3) "DD5.1 640K", -aid 1, -alang chi
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [avc1]  1920x798  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
Load subtitles in ./
SUB: Added subtitle file (1): ./Black[1].Hawk.Down.2001.BluRay.1080p.DTS.2Audio.x264-CHD.Eng.srt
SUB: Added subtitle file (2): ./Black[1].Hawk.Down.2001.BluRay.1080p.DTS.2Audio.x264-CHD.chs.srt
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [dshowserver] DirectShowServer video codecs
[PP] Using codec's postprocessing, max q = 4.
Movie-Aspect is 2.41:1 - prescaling to correct movie aspect.
VO: [gl] 1920x798 => 1920x798 Planar YV12
dshowserver --codec CoreAVCDecoder.ax --size 1920x798 --guid 09571a4b-f1fe-4c60-9760de6d310c7c31 --fourc 0x31637661 --bits 12 --outfmt 0x32315659 --pid 2052 --id b40c78f0 --numpages 10 --port 1463 &
Opening device (port is 1463)
len: 992
ProductVersion: 2.0.0
fixme:thread:SetThreadIdealProcessor (0x78): stub
fixme:thread:SetThreadIdealProcessor (0x7c): stub
ALSA lib seq_hw.c:457snd_seq_hw_open) open /dev/snd/seq failed: 没有那个文件或目录
fixme:mixer:ALSA_MixerInit No master control found on M Audio Audiophile 24/96, disabling mixer
err:module:load_builtin_dll failed to load .so lib for builtin L"wineesd.drv": libesd.so.0: 无法打开共享对象文件: 没有那个文件或目录
Decoder supports the following YUV formats: YUY2 UYVY YV12 I420
Found DirectShow filterSelected video codec: [coreserve] vfm: dshowserver (CoreAVC DShow H264 decoder x.x for x86 - http://corecodec.org/)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [ffdca] afm: ffmpeg (FFmpeg DTS)
==========================================================================
EINPROGRESS in connect() - selecting
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
A:   3.2 V:   3.2 A-V:  0.000 ct: -0.001   0/  0  4%  9%  2.0% 0 0 $<50>
[ASPECT] Warning: No suitable new res found!
[ASPECT] Warning: No suitable new res found!
Decoder is capable of YUV output (flags 0x2b)  0  3%  8%  1.9% 0 0 $<50>
Setting fmt
Starting
Initialization is complete
Using socket based mutex
Dshowserver Connected to host
************
in-frames: 219 out-frames: 212
************
Destroying filter

Exiting... (Quit)


CoreAVC好像工作得不是非常好,有时候会僵死,以前用CoreAVC能放的SONY婚礼演示片现在放不了,不知道为啥
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-2-6 20:58:00 | 显示全部楼层
通用测试:

mplayer 朱虹*

MPlayer SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team
161 audio & 352 video codecs
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing 朱虹_芒花1080P.
MPEG-PS file format detected.
VIDEO:  MPEG2  1920x1088  (aspect 3)  25.000 fps  35003.2 kbps (4375.4 kbyte/s)
Load subtitles in ./
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[ac3 @ 0x8a4a840]frame sync error
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [gl] 1920x1088 => 1934x1088 Planar YV12
A:1342.7 V:1342.7 A-V: -0.000 ct: -0.236 109/109 47%  1%  3.1% 1 0 $<50>
[ASPECT] Warning: No suitable new res found!
[ASPECT] Warning: No suitable new res found!
A:1353.6 V:1353.6 A-V:  0.000 ct: -0.236 381/381 46%  1%  2.8% 1 0 $<50>

Exiting... (Quit)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-2-6 22:53:48 | 显示全部楼层
DTS/AC3 Passthrough 输至外置解码器硬解测试

mplayer -ac hwdts,hwac3 Sun*.ts
MPlayer SVN-r32848-4.3.0 (C) 2000-2011 MPlayer Team
161 audio & 352 video codecs
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick

Playing Sunday Night Fever HDTV 1080P x264.ts.
TS file format detected.
VIDEO H264(pid=851) AUDIO A52(pid=853) NO SUBS (yet)!  PROGRAM N. 85
FPS seems to be: 25.000000
Load subtitles in ./
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Forced audio codec: hwdts
Forced audio codec: hwac3
Opening audio decoder: [hwac3] AC3/DTS pass-through S/PDIF
hwac3: switched to AC3, 384000 bps, 48000 Hz

AUDIO: 48000 Hz, 2 ch, ac3be, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [hwac3] afm: hwac3 (AC3 through S/PDIF)
==========================================================================
AO: [alsa] 48000Hz 2ch ac3be (2 bytes per sample)
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [gl] 1920x1080 => 1920x1080 Planar YV12
A:4755.4 V:4755.9 A-V: -0.550 ct: -0.468 121/121 85% 10%  0.3% 18 0 $<50>
[ASPECT] Warning: No suitable new res found!
[ASPECT] Warning: No suitable new res found!
A:4758.2 V:4758.5 A-V: -0.299 ct: -0.724 185/185 84% 11%  0.5% 20 0 $<50>

Exiting... (Quit)
回复 支持 反对

使用道具 举报

发表于 2011-2-16 13:02:10 | 显示全部楼层
LZ的基本系统是什么?LFS么
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-3-7 15:19:01 | 显示全部楼层
楼上的肯定没有看我的签名
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表