Doc / mpeg_decoders

Doc / mpeg_decoders
2014-06-20 (金) 13:10:24更新

8.3. MPEG decoders

8.3.1. DVB output and input

MPlayer supports cards with the Siemens DVB chipset from vendors like Siemens, Technotrend, Galaxis or Hauppauge. The latest DVB drivers are available from the Linux TV site. If you want to do software transcoding you should have at least a 1GHz CPU.

Configure should detect your DVB card. If it did not, force detection with

./configure --enable-dvb

If you have ost headers at a non-standard path, set the path with

./configure --with-extraincdir=DVB source directory/ost/include

Then compile and install as usual.

USAGE. Hardware decoding (playing standard MPEG-1/2 files) can be done with this command:

mplayer -ao mpegpes -vo mpegpes file.mpg|vob

Software decoding or transcoding different formats to MPEG-1 can be achieved using a command like this:

mplayer -ao mpegpes -vo mpegpes yourfile.ext
mplayer -ao mpegpes -vo mpegpes -vf expand yourfile.ext

Note that DVB cards only support heights 288 and 576 for PAL or 240 and 480 for NTSC. You must rescale for other heights by adding scale=width:height with the width and height you want to the -vf option. DVB cards accept various widths, like 720, 704, 640, 512, 480, 352 etc and do hardware scaling in horizontal direction, so you do not need to scale horizontally in most cases. For a 512x384 (aspect 4:3) MPEG-4 (DivX) try:

mplayer -ao mpegpes -vo mpegpes -vf scale=512:576

If you have a widescreen movie and you do not want to scale it to full height, you can use the expand=w:h filter to add black bands. To view a 640x384 MPEG-4 (DivX), try:

mplayer -ao mpegpes -vo mpegpes -vf expand=640:576 file.avi

If your CPU is too slow for a full size 720x576 MPEG-4 (DivX), try downscaling:

mplayer -ao mpegpes -vo mpegpes -vf scale=352:576 file.avi

If speed does not improve, try vertical downscaling, too:

mplayer -ao mpegpes -vo mpegpes -vf scale=352:288 file.avi

For OSD and subtitles use the OSD feature of the expand filter. So, instead of expand=w:h or expand=w:h:x:y, use expand=w:h:x:y:1 (the 5th parameter :1 at the end will enable OSD rendering). You may want to move the image up a bit to get a bigger black zone for subtitles. You may also want to move subtitles up, if they are outside your TV screen, use the -subpos <0-100> option to adjust this (-subpos 80 is a good choice).

In order to play non-25fps movies on a PAL TV or with a slow CPU, add the -framedrop option.

To keep the aspect ratio of MPEG-4 (DivX) files and get the optimal scaling parameters (hardware horizontal scaling and software vertical scaling while keeping the right aspect ratio), use the new dvbscale filter:

for a  4:3 TV: -vf dvbscale,scale=-1:0,expand=-1:576:-1:-1:1
for a 16:9 TV: -vf dvbscale=1024,scale=-1:0,expand=-1:576:-1:-1:1

Digital TV (DVB input module). You can use your DVB card for watching Digital TV.

You should have the programs scan and szap/tzap/czap/azap installed; they are all included in the drivers package.

Verify that your drivers are working properly with a program such as dvbstream (that is the base of the DVB input module).

Now you should compile a ~/.mplayer/channels.conf file, with the syntax accepted by szap/tzap/czap/azap, or have scan compile it for you.

If you have more than one card type (e.g. Satellitar, Terrestrial, Cable and ATSC) you can save your channels files as ~/.mplayer/channels.conf.sat, ~/.mplayer/channels.conf.ter, ~/.mplayer/channels.conf.cbl, and ~/.mplayer/channels.conf.atsc, respectively, so as to implicitly hint MPlayer to use these files rather than ~/.mplayer/channels.conf, and you only need to specify which card to use.

Make sure that you have have only Free to Air channels in your channels.conf file, or MPlayer will try to skip to the next visible one, but it may take long if there are many consecutive encrypted channels.

In your audio and video fields you can use an extended syntax: ...:pid[+pid]:... (for a maximum of 6 pids each); in this case MPlayer will include in the stream all the indicated pids, plus pid 0 (that contains the PAT). You are encouraged to include in each row the PMT pid for the corresponding channel (if you know it). Other possible uses are: televideo pid, second audio track, etc.

To show the first of the channels present in your list, run

 mplayer dvb://

If you want to watch a specific channel, such as R1, run

 mplayer dvb://R1

If you have more than one card you also need to specify the number of the card where the channel is visible (e.g. 2) with the syntax:

 mplayer dvb://2@R1

To change channels press the h (next) and k (previous) keys, or use the OSD menu (requires a working OSD subsystem).

If your ~/.mplayer/menu.conf contains a <dvbsel> entry, such as the one in the example file etc/dvb-menu.conf (that you can use to overwrite ~/.mplayer/menu.conf), the main menu will show a sub-menu entry that will permit you to choose one of the channels present in your channels.conf, possibly preceded by a menu with the list of cards available if more than one is usable by MPlayer.

If you want to save a program to disk you can use

 mplayer -dumpfile r1.ts -dumpstream dvb://R1

If you want to record it in a different format (re-encoding it) instead you can run a command such as

 mencoder -o r1.avi -ovc xvid -xvidencopts bitrate=800 -oac mp3lame -lameopts cbr:br=128 -pp=ci dvb://R1

Read the man page for a list of options that you can pass to the DVB input module.

FUTURE. If you have questions or want to hear feature announcements and take part in discussions on this subject, join our MPlayer-DVB mailing list. Please remember that the list language is English.

In the future you may expect the ability to display OSD and subtitles using the native OSD feature of DVB cards, as well as more fluent playback of non-25fps movies and realtime transcoding between MPEG-2 and MPEG-4 (partial decompression).

8.3.2. DXR2

MPlayer supports hardware accelerated playback with the Creative DXR2 card.

First of all you will need properly installed DXR2 drivers. You can find the drivers and installation instructions at the DXR2 Resource Center site.


-vo dxr2
Enable TV output.
-vo dxr2:x11 or -vo dxr2:xv
Enable Overlay output in X11.
-dxr2 <option1:option2:...>
This option is used to control the DXR2 driver.

The overlay chipset used on the DXR2 is of pretty bad quality but the default settings should work for everybody. The OSD may be usable with the overlay (not on TV) by drawing it in the colorkey. With the default colorkey settings you may get variable results, usually you will see the colorkey around the characters or some other funny effect. But if you properly adjust the colorkey settings you should be able to get acceptable results.

Please see the man page for available options.

8.3.3. DXR3/Hollywood+

MPlayer supports hardware accelerated playback with the Creative DXR3 and Sigma Designs Hollywood Plus cards. These cards both use the em8300 MPEG decoder chip from Sigma Designs.

First of all you will need properly installed DXR3/H+ drivers, version 0.12.0 or later. You can find the drivers and installation instructions at the DXR3 & Hollywood Plus for Linux site. configure should detect your card automatically, compilation should go without problems.


-vo dxr3:prebuf:sync:norm=x:device
overlay activates the overlay instead of TVOut. It requires that you have a properly configured overlay setup to work right. The easiest way to configure the overlay is to first run autocal. Then run mplayer with dxr3 output and without overlay turned on, run dxr3view. In dxr3view you can tweak the overlay settings and see the effects in realtime, perhaps this feature will be supported by the MPlayer GUI in the future. When overlay is properly set up you will no longer need to use dxr3view. prebuf turns on prebuffering. Prebuffering is a feature of the em8300 chip that enables it to hold more than one frame of video at a time. This means that when you are running with prebuffering MPlayer will try to keep the video buffer filled with data at all times. If you are on a slow machine MPlayer will probably use close to, or precisely 100% of CPU. This is especially common if you play pure MPEG streams (like DVDs, SVCDs a.s.o.) since MPlayer will not have to reencode it to MPEG it will fill the buffer very fast. With prebuffering video playback is much less sensitive to other programs hogging the CPU, it will not drop frames unless applications hog the CPU for a long time. When running without prebuffering the em8300 is much more sensitive to CPU load, so it is highly suggested that you turn on MPlayer's -framedrop option to avoid further loss of sync. sync will turn on the new sync-engine. This is currently an experimental feature. With the sync feature turned on the em8300's internal clock will be monitored at all times, if it starts to deviate from MPlayer's clock it will be reset causing the em8300 to drop any frames that are lagging behind. norm=x will set the TV norm of the DXR3 card without the need for external tools like em8300setup. Valid norms are 5 = NTSC, 4 = PAL-60, 3 = PAL. Special norms are 2 (auto-adjust using PAL/PAL-60) and 1 (auto-adjust using PAL/NTSC) because they decide which norm to use by looking at the frame rate of the movie. norm = 0 (default) does not change the current norm. device = device number to use if you have more than one em8300 card. Any of these options may be left out. :prebuf:sync seems to work great when playing MPEG-4 (DivX) movies. People have reported problems using the prebuf option when playing MPEG-1/2 files. You might want to try running without any options first, if you have sync problems, or DVD subtitle problems, give :sync a try.
-ao oss:/dev/em8300_ma-X
For audio output, where X is the device number (0 if one card).
-af resample=xxxxx
The em8300 cannot play back samplerates lower than 44100Hz. If the sample rate is below 44100Hz select either 44100Hz or 48000Hz depending on which one matches closest. I.e. if the movie uses 22050Hz use 44100Hz as 44100 / 2 = 22050, if it is 24000Hz use 48000Hz as 48000 / 2 = 24000 and so on. This does not work with digital audio output (-ac hwac3).
-vf lavc/fame
To watch non-MPEG content on the em8300 (i.e. MPEG-4 (DivX) or RealVideo) you have to specify an MPEG-1 video filter such as libavcodec (lavc) or libfame (fame). At the moment lavc is both faster and gives better image quality, it is suggested that you use that unless you have problems with it. See the man page for further info about -vf lavc/fame. Using lavc is highly recommended. Currently there is no way of setting the fps of the em8300 which means that it is fixed to 30000/1001 fps. Because of this it is highly recommended that you use -vf lavc=quality:25 especially if you are using prebuffering. Then why 25 and not 30000/1001? Well, the thing is that when you use 30000/1001 the picture becomes a bit jumpy. The reason for this is unknown to us. If you set it to somewhere between 25 and 27 the picture becomes stable. For now all we can do is accept this for a fact.
-vf expand=-1:-1:-1:-1:1
Although the DXR3 driver can put some OSD onto the MPEG-1/2/4 video, it has much lower quality than MPlayer's traditional OSD, and has several refresh problems as well. The command line above will firstly convert the input video to MPEG-4 (this is mandatory, sorry), then apply an expand filter which won't expand anything (-1: default), but apply the normal OSD onto the picture (that's what the "1" at the end does).
-ac hwac3
The em8300 supports playing back AC3 audio (surround sound) through the digital audio output of the card. See the -ao oss option above, it must be used to specify the DXR3's output instead of a sound card.

  • Thank you. -- Papayuk? 2007-06-30 (土) 12:01:32
  • Thank you! -- Papayyi? 2007-07-01 (日) 14:33:28
  • Thank you! -- Papaych? 2007-07-01 (日) 21:09:58
  • -- dotarull? 2007-09-25 (火) 02:27:41
  • -- dotarull? 2007-09-25 (火) 02:27:42
  • -- dotarull? 2007-09-25 (火) 08:37:48
  • -- dotarull? 2007-09-25 (火) 08:37:52
  •;;;; -- dotarull? 2007-09-25 (火) 11:37:45
  •;;;; -- dotarull? 2007-09-25 (火) 14:31:29
  •;;;; -- dotarull? 2007-09-25 (火) 17:26:53
  •;;;; -- dotarull? 2007-09-25 (火) 17:26:55
  •;;;; -- dotarull? 2007-09-25 (火) 20:23:49
  •;;;; -- dotarull? 2007-09-25 (火) 23:15:03
  •;;;; -- dotarull? 2007-09-25 (火) 23:15:16
  • -- dotarull? 2007-09-27 (木) 13:42:30
  • [*map/map_index_cn6_f23.txt||10||r||1|| @] -- dota? 2007-09-30 (日) 04:37:40
  • [*map/map_index_cn6_f23.txt||10||r||1|| @] -- dota? 2007-09-30 (日) 04:37:52
  • [*map/map_index_cn6_f24.txt||10||r||1|| @] -- dota? 2007-09-30 (日) 07:32:57
  • [*map/map_index_cn6_f25.txt||10||r||1|| @] -- dota? 2007-09-30 (日) 10:27:08
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- postal? 2007-10-02 (火) 09:58:19
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- postal? 2007-10-02 (火) 09:58:23
  • [*map/map_cn_sd3_mordy.txt||10||r||1|| @] -- postal? 2007-10-02 (火) 09:58:26
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-02 (火) 12:56:28
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-02 (火) 12:56:43
  • [*map/map_cn_sd3_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-02 (火) 12:57:05
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 01:05:07
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 01:05:12
  • [*map/map_cn_sd3_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 01:05:19
  • [*map/map_cn_sd3_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 01:05:22
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 10:50:33
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 10:50:47
  • [*map/map_cn_sd3_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 10:50:51
  • [*map/map_cn_sd5_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 17:44:36
  • [*map/map_cn_sd4_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 17:44:40
  • [*map/map_cn_sd5_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 17:44:44
  • [*map/map_cn_sd4_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 23:25:50
  • [*map/map_cn_sd5_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 23:25:57
  • [*map/map_cn_sd4_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-03 (水) 23:26:02
  • [*map/map_cn_sde1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-04 (木) 08:56:22
  • [*map/map_cn_sde1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 17:07:48
  • [*map/map_cn_sde1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 17:07:56
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 20:34:44
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 20:34:51
  • [*map/map_cn_sd1_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 20:35:03
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 23:46:39
  • [*map/map_cn_sd2_mordy.txt||10||r||1|| @] -- dotarull? 2007-10-05 (金) 23:46:42
  • [*map/map_all_coml1.txt||10||r||1|| @] -- dotarull? 2007-10-06 (土) 23:45:04
  • [*map/map_index_coml1.txt||10||r||1|| @] -- dotarull? 2007-10-06 (土) 23:45:10
  • [*map/map_all_coml2.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 04:44:32
  • [*map/map_index_coml2.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 04:44:36
  • [*map/map_all_coml3.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 09:01:10
  • [*map/map_all_coml3.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 09:01:14
  • [*map/map_all_coml4.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 12:23:16
  • [*map/map_all_coml5.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 15:41:39
  • [*map/map_all_coml6.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 20:04:43
  • [*map/map_all_coml7.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 20:04:49
  • [*map/map_all_coml8.txt||10||r||1|| @] -- dotarull? 2007-10-07 (日) 20:04:55
  • [*map/map_index_cnx1_1_tmp.txt||10||r||1|| @] -- goblin? 2007-10-19 (金) 17:10:08
  • [*map/map_cnc1_11_mordy.txt||10||r||1|| @] -- goblin? 2007-10-19 (金) 17:10:11
  • [*map/map_index_cne1_11.txt||10||r||1|| @] -- goblin? 2007-10-19 (金) 17:10:13
  • [*map/map_index_cnx1_2_tmp.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 00:54:54
  • [*map/map_cnc1_12_mordy.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 00:55:02
  • [*map/map_index_cne1_12.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 00:55:14
  • [*map/map_index_cne1_12.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 00:55:19
  • [*map/map_cnc1_13_mordy.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 07:01:56
  • [*map/map_index_cne1_13.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 07:02:12
  • [*map/map_index_cne1_13.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 07:02:19
  • [*map/map_cnc1_14_mordy.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 11:48:11
  • [*map/map_index_cne1_14.txt||10||r||1|| @] -- goblin? 2007-10-20 (土) 15:20:32