前段时间做过qt内嵌mplayer的一个小程序,感觉mplayer还行不过不支持打开图片感觉有点无力。话不多说上代码:

    QString path="d:/1.mkv";QWidget *vw=new QWidget(this);vw->resize(400,300);QString common = "E:/testmplayer/debug/mplayer/MPlayer.exe -slave -quiet -vo direct3d   -wid " + QString::number(reinterpret_cast<qlonglong>(vw->winId())) + " "+ (path);process=new QProcess();process->start(common);

这样一个小的播放器就做好了,通过命令方式启动 myplayer.exe  其中  -slave就是用后台命令控制的意思

process->write("xxx\n"); //xxx为操作指令必须要有\n
在mplayer官网上,可以看到下面的命令:
-------------------The -slave option switches on slave mode, in which MPlayer works as a backend
for other programs. Instead of intercepting keyboard events, MPlayer will read
commands separated by a newline(\n)from stdin.To try slave mode out by hand, runmplayer-slave -quiet <movie>and type slave commands into the console window.You can also use a fifo file (named pipe):mkfifo </tmp/fifofile>mplayer -slave -input file=</tmp/fifofile> <movie>Most slave mode commands are equivalent to command line options, though not
necessarily under the same name. Detailed descriptions can be found in the
man page.All commands can be prefixed with one of "pausing ", "pausing_keep ", or
"pausing_toggle ". "pausing " tells MPlayer to pause as soon as possible
after processing the command. "pausing_keep " tells MPlayer to do so only if
it was already in paused mode. "pausing_toggle " tells MPlayer to do so
only if it was not already in paused mode. Please note that "as soon as
possible" can be before the command is fully executed.
As a temporary hack, there is also the _experimental_ "pausing_keep_force "
prefix, with which MPlayer will not exit the pause loop at all.
Like this you can avoid the "frame stepping" effect of "pausing_keep "
but most commands will either not work at all or behave in unexpected ways.
For "set_mouse_pos" and "key_down_event", "pausing_keep_force" is the default
since other values do not make much sense for them.Various tips and tricks (please help expand it!):- Try using something likepausing_keep_force pt_step 1get_property pauseto switch to the next file. It avoids audio playback starting to playthe old file for a short time before switching to the new one.
- To ensure the user can't control MPlayer "behind your back" usesomething like -input nodefault-bindings -noconfig allAvailable commands ('mplayer -input cmdlist' will print a list):af_add <filter_arguments_list>  (comma separated list of audio filters with parameters)(experimental) Load the given list of audio filters.af_clr(experimental) Unload all loaded audio filters.af_cmdline <filter_name> <filter_arguments>(experimental) Send new command-line options to a filter with the given name.af_del <filter_name_list> (comma separated list of audio filter's names)(experimental) Unload the first occurrence of the filters, if loaded.af_switch <filter_arguments_list> (comma separated list of audio filters with parameters)(experimental) Remove all the audio filters and replace them with the given list.alt_src_step <value> (ASX playlist only)When more than one source is available it selects the next/previous one.audio_delay <value> [abs]Set/adjust the audio delay.If [abs] is not given or is zero, adjust the delay by <value> seconds.If [abs] is nonzero, set the delay to <value> seconds.[brightness|contrast|gamma|hue|saturation] <value> [abs]Set/adjust video parameters.If [abs] is not given or is zero, modifies parameter by <value>.If [abs] is non-zero, parameter is set to <value>.<value> is in the range [-100, 100].capturing [value]Toggle/set capturing the primary stream like -dumpstream.Requires the -capture parameter to be given.change_rectangle <val1> <val2>Change the position of the rectangle filter rectangle.<val1>Must be one of the following:0 = width1 = height2 = x position3 = y position<val2>If <val1> is 0 or 1:Integer amount to add/subtract from the width/height.Positive values add to width/height and negative valuessubtract from it.If <val1> is 2 or 3:Relative integer amount by which to move the upper leftrectangle corner. Positive values move the rectangleright/down and negative values move the rectangle left/up.dvb_set_channel <channel_number> <card_number>Set DVB channel.dvdnav <button_name>Press the given dvdnav button.updownleftrightmenuselectprevmouseedl_loadfile <filename>Load new EDL file.edl_markWrite the current position into the EDL file.frame_drop [value]Toggle/set frame dropping mode.get_audio_bitratePrint out the audio bitrate of the current file.get_audio_codecPrint out the audio codec name of the current file.get_audio_samplesPrint out the audio frequency and number of channels of the current file.get_file_namePrint out the name of the current file.get_meta_albumPrint out the 'Album' metadata of the current file.get_meta_artistPrint out the 'Artist' metadata of the current file.get_meta_commentPrint out the 'Comment' metadata of the current file.get_meta_genrePrint out the 'Genre' metadata of the current file.get_meta_titlePrint out the 'Title' metadata of the current file.get_meta_trackPrint out the 'Track Number' metadata of the current file.get_meta_yearPrint out the 'Year' metadata of the current file.get_percent_posPrint out the current position in the file, as integer percentage [0-100).get_property <property>Print out the current value of a property.get_sub_visibilityPrint out subtitle visibility (1 == on, 0 == off).get_time_lengthPrint out the length of the current file in seconds.get_time_posPrint out the current position in the file in seconds, as float.get_vo_fullscreenPrint out fullscreen status (1 == fullscreened, 0 == windowed).get_video_bitratePrint out the video bitrate of the current file.get_video_codecPrint out the video codec name of the current file.get_video_resolutionPrint out the video resolution of the current file.screenshot <value>Take a screenshot. Requires the screenshot filter to be loaded.0 Take a single screenshot.1 Start/stop taking screenshot of each frame.key_down_event <value>Inject <value> key code event into MPlayer.loadfile <file|url> <append>Load the given file/URL, stopping playback of the current file/URL.If <append> is nonzero playback continues and the file/URL isappended to the current playlist instead.loadlist <file> <append>Load the given playlist file, stopping playback of the current file.If <append> is nonzero playback continues and the playlist file isappended to the current playlist instead.loop <value> [abs]Adjust/set how many times the movie should be looped. -1 means no loop,and 0 forever.menu <command>Execute an OSD menu command.up     Move cursor up.down   Move cursor down.ok     Accept selection.cancel Cancel selection.hide   Hide the OSD menu.set_menu <menu_name>Display the menu named <menu_name>.mute [value]Toggle sound output muting or set it to [value] when [value] >= 0(1 == on, 0 == off).osd [level]Toggle OSD mode or set it to [level] when [level] >= 0.osd_show_progressionShow the progression bar, the elapsed time and the total duration of themovie on the OSD.osd_show_property_text <string> [duration] [level]Show an expanded property string on the OSD, see -playing-msg for adescription of the available expansions. If [duration] is >= 0 the textis shown for [duration] ms. [level] sets the minimum OSD level neededfor the message to be visible (default: 0 - always show).osd_show_text <string> [duration] [level]Show <string> on the OSD.panscan <-1.0 - 1.0> | <0.0 - 1.0> <abs>Increase or decrease the pan-and-scan range by <value>, 1.0 is the maximum.Negative values decrease the pan-and-scan range.If <abs> is != 0, then the pan-and scan range is interpreted as anabsolute range.pausePause/unpause the playback.frame_stepPlay one frame, then pause again.pt_step <value> [force]Go to the next/previous entry in the playtree. The sign of <value> tellsthe direction.  If no entry is available in the given direction it will donothing unless [force] is non-zero.pt_up_step <value> [force]Similar to pt_step but jumps to the next/previous entry in the parent list.Useful to break out of the inner loop in the playtree.quit [value]Quit MPlayer. The optional integer [value] is used as the return codefor the mplayer process (default: 0).radio_set_channel <channel>Switch to <channel>. The 'channels' radio parameter needs to be set.radio_set_freq <frequency in MHz>Set the radio tuner frequency.radio_step_channel <-1|1>Step forwards (1) or backwards (-1) in channel list. Works only when the'channels' radio parameter was set.radio_step_freq <value>Tune frequency by the <value> (positive - up, negative - down).seek <value> [type]Seek to some place in the movie.0 is a relative seek of +/- <value> seconds (default).1 is a seek to <value> % in the movie.2 is a seek to an absolute position of <value> seconds.seek_chapter <value> [type]Seek to the start of a chapter.0 is a relative seek of +/- <value> chapters (default).1 is a seek to chapter <value>.switch_angle <value>Switch to the angle with the ID [value]. Cycle through theavailable angles if [value] is omitted or negative.set_mouse_pos <x> <y>Tells MPlayer the coordinates of the mouse in the window.This command doesn't move the mouse!set_property <property> <value>Set a property.speed_incr <value>Add <value> to the current playback speed.speed_mult <value>Multiply the current speed by <value>.speed_set <value>Set the speed to <value>.step_property <property> [value] [direction]Change a property by value, or increase by a default if value isnot given or zero. The direction is reversed if direction is lessthan zero.stopStop playback.sub_alignment [value]Toggle/set subtitle alignment.0 top alignment1 center alignment2 bottom alignmentsub_delay <value> [abs]Adjust the subtitle delay by +/- <value> seconds or set it to <value>seconds when [abs] is nonzero.sub_load <subtitle_file>Loads subtitles from <subtitle_file>.sub_logLogs the current or last displayed subtitle together with filenameand time information to ~/.mplayer/subtitle_log. Intended purposeis to allow convenient marking of bogus subtitles which need to befixed while watching the movie.sub_pos <value> [abs]Adjust/set subtitle position.sub_remove [value]If the [value] argument is present and non-negative, removes the subtitlefile with index [value]. If the argument is omitted or negative, removesall subtitle files.sub_select [value]Display subtitle with index [value]. Turn subtitle display off if[value] is -1 or greater than the highest available subtitle index.Cycle through the available subtitles if [value] is omitted or lessthan -1 (forward or backward respectively).Supported subtitle sources are -sub options on the commandline, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.This command is mainly for cycling all subtitles, if you want to seta specific subtitle, use sub_file, sub_vob, or sub_demux.sub_source [source]Display first subtitle from [source]. Here [source] is an integer:SUB_SOURCE_SUBS   (0) for file subsSUB_SOURCE_VOBSUB (1) for VOBsub filesSUB_SOURCE_DEMUX  (2) for subtitle embedded in the media file or DVD subs.If [source] is -1, will turn off subtitle display.If [value] is omitted or less than -1, will cycle between the first subtitleof each currently available source (forward or backward respectively).sub_file [value]Display subtitle specifid by [value] for file subs. The [value] iscorresponding to ID_FILE_SUB_ID values reported by '-identify'.If [value] is -1, will turn off subtitle display.If [value] is omitted or less than -1, will cycle all file subs(forward or backward respectively).sub_vob [value]Display subtitle specifid by [value] for vobsubs. The [value] iscorresponding to ID_VOBSUB_ID values reported by '-identify'.If [value] is -1, will turn off subtitle display.If [value] is omitted or less than -1, will cycle all vobsubs(forward or backward respectively).sub_demux [value]Display subtitle specifid by [value] for subtitles from DVD or embeddedin media file. The [value] is corresponding to ID_SUBTITLE_ID valuesreported by '-identify'. If [value] is -1, will turn off subtitle display.If [value] is omitted or less than -1, will cycle all DVD subs or embedded subs(forward or backward respectively).sub_scale <value> [abs]Adjust the subtitle size by +/- <value> or set it to <value> when [abs]is nonzero.vobsub_langThis is a stub linked to sub_select for backwards compatibility.sub_step <value>Step forward in the subtitle list by <value> steps or backwards if <value>is negative.sub_visibility [value]Toggle/set subtitle visibility.forced_subs_only [value]Toggle/set forced subtitles only.switch_audio [value] (currently MPEG*, AVI, Matroska and streams handled by libavformat)Switch to the audio track with the ID [value]. Cycle through theavailable tracks if [value] is omitted or negative.switch_angle [value] (DVDs only)Switch to the DVD angle with the ID [value]. Cycle through theavailable angles if [value] is omitted or negative.switch_ratio [value]Change aspect ratio at runtime. [value] is the new aspect ratio expressedas a float (e.g. 1.77778 for 16/9).There might be problems with some video filters.switch_title [value] (DVDNAV only)Switch to the DVD title with the ID [value]. Cycle through theavailable titles if [value] is omitted or negative.switch_vsync [value]Toggle vsync (1 == on, 0 == off). If [value] is not provided,vsync status is inverted.teletext_add_digit <value>Enter/leave teletext page number editing mode and append given digit topreviously entered one.0..9 - Append apropriate digit. (Enables editing mode if called from normalmode, and switches to normal mode when third digit is entered.)-    - Delete last digit from page number. (Backspace emulation, works onlyin page number editing mode.)teletext_go_link <1-6>Follow given link on current teletext page.tv_start_scanStart automatic TV channel scanning.tv_step_channel <channel>Select next/previous TV channel.tv_step_normChange TV norm.tv_step_chanlistChange channel list.tv_set_channel <channel>Set the current TV channel.tv_last_channelSet the current TV channel to the last one.tv_set_freq <frequency in MHz>Set the TV tuner frequency.tv_step_freq <frequency offset in MHz>Set the TV tuner frequency relative to current value.tv_set_norm <norm>Set the TV tuner norm (PAL, SECAM, NTSC, ...).tv_set_brightness <-100 - 100> [abs]Set TV tuner brightness or adjust it if [abs] is set to 0.tv_set_contrast <-100 -100> [abs]Set TV tuner contrast or adjust it if [abs] is set to 0.tv_set_hue <-100 - 100> [abs]Set TV tuner hue or adjust it if [abs] is set to 0.tv_set_saturation <-100 - 100> [abs]Set TV tuner saturation or adjust it if [abs] is set to 0.use_masterSwitch volume control between master and PCM.vo_border [value]Toggle/set borderless display.vo_fullscreen [value]Toggle/set fullscreen mode.vo_ontop [value]Toggle/set stay-on-top.vo_rootwin [value]Toggle/set playback on the root window.volume <value> [abs]Increase/decrease volume or set it to <value> if [abs] is nonzero.overlay_add <file> <id> <x> <y> <color>Add an overlay bitmap. <file> must be a PGM file without comments.<id> is an arbitrary integer used to identify the overlay.overlay_remove <id>Remove all overlays identified by <id>.The following commands are really only useful for OSD menu console mode:helpDisplays help text, currently empty.exitExits from OSD menu console. Unlike 'quit', does not quit MPlayer.hideHides the OSD menu console. Clicking a menu command unhides it. Otherkeybindings act as usual.run <value>Run <value> as shell command. In OSD menu console mode stdout and stdinare through the video output driver.Available properties:name               type      min     max     get set step comment
=================================================================osdlevel           int       0       3       X   X   X    as -osdlevel
speed              float     0.01    100     X   X   X    as -speed
loop               int       -1              X   X   X    as -loop
pause              flag      0       1       X            1 if paused, use with pausing_keep_force
filename           string                    X            file playing wo path
path               string                    X            file playing
demuxer            string                    X            demuxer used
stream_pos         pos       0               X   X        position in stream
stream_start       pos       0               X            start pos in stream
stream_end         pos       0               X            end pos in stream
stream_length      pos       0               X            (end - start)
stream_time_pos    time      0               X            present position in stream (in seconds)
chapter            int       0               X   X   X    select chapter
chapters           int                       X            number of chapters
angle              int       0               X   X   X    select angle
length             time                      X            length of file in seconds
percent_pos        int       0       100     X   X   X    position in percent
time_pos           time      0               X   X   X    position in seconds
metadata           str list                  X            list of metadata key/value
metadata/*         string                    X            metadata values
volume             float     0       100     X   X   X    change volume
balance            float     -1      1       X   X   X    change audio balance
mute               flag      0       1       X   X   X
audio_delay        float     -100    100     X   X   X
audio_format       int                       X
audio_codec        string                    X
audio_bitrate      int                       X
samplerate         int                       X
channels           int                       X
switch_audio       int       -2      255     X   X   X    select audio stream
switch_angle       int       -2      255     X   X   X    select DVD angle
switch_title       int       -2      255     X   X   X    select DVD title
capturing          flag      0       1       X   X   X    dump primary stream if enabled
fullscreen         flag      0       1       X   X   X
deinterlace        flag      0       1       X   X   X
ontop              flag      0       1       X   X   X
rootwin            flag      0       1       X   X   X
border             flag      0       1       X   X   X
framedropping      int       0       2       X   X   X    1 = soft, 2 = hard
gamma              int       -100    100     X   X   X
brightness         int       -100    100     X   X   X
contrast           int       -100    100     X   X   X
saturation         int       -100    100     X   X   X
hue                int       -100    100     X   X   X
panscan            float     0       1       X   X   X
vsync              flag      0       1       X   X   X
video_format       int                       X
video_codec        string                    X
video_bitrate      int                       X
width              int                       X            "display" width
height             int                       X            "display" height
fps                float                     X
aspect             float                     X
switch_video       int       -2      255     X   X   X    select video stream
switch_program     int       -1      65535   X   X   X    (see TAB default keybind)
sub                int       -1              X   X   X    select subtitle stream
sub_source         int       -1      2       X   X   X    select subtitle source
sub_file           int       -1              X   X   X    select file subtitles
sub_vob            int       -1              X   X   X    select vobsubs
sub_demux          int       -1              X   X   X    select subs from demux
sub_delay          float                     X   X   X
sub_pos            int       0       100     X   X   X    subtitle position
sub_alignment      int       0       2       X   X   X    subtitle alignment
sub_visibility     flag      0       1       X   X   X    show/hide subtitles
sub_forced_only    flag      0       1       X   X   X
sub_scale          float     0       100     X   X   X    subtitles font size
tv_brightness      int       -100    100     X   X   X
tv_contrast        int       -100    100     X   X   X
tv_saturation      int       -100    100     X   X   X
tv_hue             int       -100    100     X   X   X
teletext_page      int       0       799     X   X   X
teletext_subpage   int       0       64      X   X   X
teletext_mode      flag      0       1       X   X   X    0 - off, 1 - on
teletext_format    int       0       3       X   X   X    0 - opaque,1 - transparent,2 - opaque inverted,3 - transp. inv.
teletext_half_page int       0       2       X   X   X    0 - off, 1 - top half,2- bottom half

常用的命令我用红色标出来了,用 -slave 使其与键盘分离,我们可以建一个进程,如:QProcess *process;

如果我们想让他快进,可以用:

process->write("seek +5\n"); 命令,记住,当与键盘分离后,mplayer接受的命令都是以\n结尾的命令,而且如果命令后还要加参数,命令和参数之间至少要有一个空格,不然起不到效果。

process->("volume +5\n");  加声音

process->("volume -5\n");  减声音

process->write("seek -5\n"); 快退

等等的命令,用法格式都是一样的,对照着官网手册,就可以设计了。

转载于:https://www.cnblogs.com/huangpeng1990/p/4364373.html

mplayer最全的命令相关推荐

  1. Ubuntu 编译安装ffmpeg,mplayer,x264全教程支持VDPAU(高清硬解)

    这个是针对Ubuntu 10.04 AMD64的安装ffmpeg,mplayer,x264全教程,包括VDPAU Ubuntu 10.10AMD64也是可以的. 目前mplayer仍然使用svn,编译 ...

  2. mplayer说明及常用命令

    mplayer说明 MPlayer:是一款开源多媒体播放器,以GNU通用公共许可证发布. 此款软件可在各主流操作系统使用,例如Linux和其他类Unix系统.Windows及Mac OS X系统. 在 ...

  3. zsh 自动补全导致命令显示重复

    关键字:autocomplete, zsh, backspace, securecrt, xterm, linux console 举个例子: 输入命令ls  然后按TAB补全试试,发现竟然是这样的 ...

  4. 一文带你学会linux系统 史上最全linux命令大全

    一文带你学会linux系统 史上最全linux命令大全 文章目录 linux系统简介 linux命令 1.启动网络命令 2.pwd命令 2.ls命令 3.cd命令 4.mkdir命令 5.rmdir命 ...

  5. 树莓派安装mplayer,并使用命令查看摄像头

    树莓派安装mplayer,并使用命令查看摄像头 1.安装mplayer 输入命令:sudo apt-get install mplayer 2.查看摄像头 输入命令: mplayer tv:// -t ...

  6. 假装认真的LaTeX学习笔记(1)—— Sublime中自动补全LaTeX命令(LaTeX-cwl安装教程)

    假装认真的LaTeX学习笔记(1)-- Sublime中自动补全LaTeX命令 简介 使用环境 如何在Sublime中获得LaTeX自动补全功能 安装Sublime插件--LaTeX-cwl 方法一: ...

  7. 150个CMD命令(史上更全cmd命令 net命令)

    目录 cmd命令大全: net命令 加油各位( •̀ ω •́ )y 期待与君再相逢 150个CMD命令(史上更全cmd命令 net命令) 运行操作cmd命令:开始-运行(或快捷键win+R) -输入 ...

  8. MPI部署踩坑实况!!!最终成功跑通梯形面积法!!!精准全流程命令+各步骤报错解决方案!!!

    MPI部署踩坑实况!!!最终成功跑通梯形面积法!!!精准全流程命令+各步骤报错解决方案!!! 写在前面,博主暂用Win10系统,本想远程连接控制个服务器走一下流程,经师兄推荐,使用WSL装了个Ubun ...

  9. Linux |奇怪的知识---complete命令---你不知道的命令参数补全---kubectl命令的参数补全

    前言: linux下有非常多的命令,其中有一些命令是比较冷门的,但比较有意思,比如,这个complete命令. complete命令定义命令或者脚本内的方法的参数自动补全内容是什么(例如,定义某个命令 ...

最新文章

  1. 利用HTML5开发Android
  2. 一些长时间GC停顿问题的排查及解决办法
  3. 多线程訪问共享数据(1)
  4. [Step By Step]SAP HANA创建层次结构的属性视图(Hierarchy Attribute View)
  5. JPA在MySQL中自动建表
  6. 小程序上传图本地片wx.chooseImage
  7. 使用SALT-API进入集成开发的简单样例
  8. 华为高管涉嫌受贿已被带走调查
  9. 软件工程2第一次作业
  10. 云服务下的安全特点及基础防护
  11. 下载离线地图数据并搭建离线地图开发环境(一套代码支持谷歌、百度、高德等所有地图源)
  12. 多媒体计算机中的扬声器指的是音箱和,怎样算合格? 音箱主要指标参数全解析...
  13. Jetson Nano配置MCP2515 CANBUS模块
  14. ApacheCN 翻译/校对/笔记整理活动进度公告 2019.9.20
  15. p2p网络中的NAT穿透
  16. 【Excel】定位条件快速将空值替换为指定值
  17. STM32L476RG利用串口下载程序
  18. 森林防火火灾漫延算法 火灾推演算法分析 火灾蔓延范围计算方法 森林火灾边界漫延计算方法
  19. el-tree 关键字搜索
  20. 开发者必看|Android 8.0 新特性及开发指南

热门文章

  1. Python中的Optional和带默认值的参数
  2. java中的默认排序规则,C#中列表,集合排序Sort,OrderBy与Java排序规则默认不一致...
  3. 高版本转低版本_Tekla高版本模型转低版本模型插件
  4. pytorch 矩阵相乘_深入浅出PyTorch(算子篇)
  5. python多进程优化_『Python』多进程处理
  6. 深圳网络推广谈论网站收录后的内容还能不能修改?
  7. 如何更科学的进行SEO优化?保持排名稳定
  8. 商城网站前期功能设置这几项绝不能少!
  9. c语言中如何自定义sort,c – 如何重载自定义std :: sort比较函数?
  10. 电脑屏保海底世界_一款电脑桌面锁屏软件:梦幻水族馆(好多鱼)