动态QLabel + mplayer slave模式播放视频,有声音无画面,解决办法
2013-05-14 10:20
746 查看
我用QProcess运行mplayer,用 QLabel的winid 将mplayer嵌入到我的程序窗口中。当我用qt的UI designer添加QLabel时,mplayer可以正常播放,但是当我在程序运行时动态生成QLabel时,QLabel的文字可以正常显示,mplayer只有声音没有画面。偶然在qt的论坛中发现了问题的解决方法:
http://www.qtforum.org/article/25844/using-mplayer-in-qt4-4.html
原文:
Hi All,
I use qprocess to run the mplayer in
my application. I use Qlabels
window ID to embed the player in my window.
Everything works fine when i create the QLabel in
qt designer but when i create the QLabel dynamically
during runtime the video is not shown on the label but i can hear the audio of the movie file.
code i use to creat the label:
QLabel *
labelMovie = new QLabel(this);
labelMovie->resize(391,281);
labelMovie->move(260,160);
labelMovie->setText("Show Movie");
labelMovie->show();
QProcess * mplayer_proc
= new QProcess();
QStringList arguments;
arguments<<"-slave"<<"-wid"<<QString::number(labelMovie->winId());
arguments<<"-really-quiet"<<"-vo"<<"x11"<<"-zoom"<<"-fs"<<"-loop"<<"0";
arguments<<"/root/abc.mpg";
mplayer_proc->start("mplayer",arguments);
I can see the label with the text "show Movie" in my screen but not the movie.
do i need to set some more properties for the QLabel ?
解决方法:
Dear
Sathyan
Have you tried to force window creation?
http://doc.trolltech.com/4.4/qcoreapplic…ml#setAttribute
http://doc.trolltech.com/4.4/qt.html#App…nAttribute-enum
Qt::AA_NativeWindows 3 Ensures that widgets have native windows.
It helped inwin32. Might work in Linux too.
我也只在windows中测试了可以正常播放,linux中有待验证。
http://www.qtforum.org/article/25844/using-mplayer-in-qt4-4.html
原文:
Hi All,
I use qprocess to run the mplayer in
my application. I use Qlabels
window ID to embed the player in my window.
Everything works fine when i create the QLabel in
qt designer but when i create the QLabel dynamically
during runtime the video is not shown on the label but i can hear the audio of the movie file.
code i use to creat the label:
QLabel *
labelMovie = new QLabel(this);
labelMovie->resize(391,281);
labelMovie->move(260,160);
labelMovie->setText("Show Movie");
labelMovie->show();
QProcess * mplayer_proc
= new QProcess();
QStringList arguments;
arguments<<"-slave"<<"-wid"<<QString::number(labelMovie->winId());
arguments<<"-really-quiet"<<"-vo"<<"x11"<<"-zoom"<<"-fs"<<"-loop"<<"0";
arguments<<"/root/abc.mpg";
mplayer_proc->start("mplayer",arguments);
I can see the label with the text "show Movie" in my screen but not the movie.
do i need to set some more properties for the QLabel ?
解决方法:
Dear
Sathyan
Have you tried to force window creation?
http://doc.trolltech.com/4.4/qcoreapplic…ml#setAttribute
http://doc.trolltech.com/4.4/qt.html#App…nAttribute-enum
Quoted
Qt::AA_NativeWindows 3 Ensures that widgets have native windows.
| |
1 2 3 4 | int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setAttribute(Qt::AA_NativeWindows, true); |
我也只在windows中测试了可以正常播放,linux中有待验证。
相关文章推荐
- debian学习笔记7, mplayer smplayer详细配置说明.解决播放视频没有画面只有声音,w32codecs.w74codecs插件配置.
- 我的Android进阶之旅------>android视频播放只有声音无画面的解决办法
- ubuntu下播放视频只有声音但黑屏的解决办法
- KMPlayer播放mkv视频不出声音的解决办法
- win7 64位系统使用百度影音播放视频没声音没画面的故障原因及解决方法
- 解决html视频播放只有声音没有图像的办法
- video标签播放视频,有声音无图像的解决办法
- Flex4.6 VideoDisplay播放flv视频时画面不清晰,显示字母时有缺损的问题的解决办法。
- win2003系统播放视频时画面差没有声音的解决方法
- win7音频服务未运行导致播放视频没声音的解决办法
- 网页视频播放时是绿色的 有声音没图像的解决办法
- HTML5 video标签播放本地视频只有声音没有图像 解决办法
- 解决Windows 7播放网页视频没有声音的问题
- iOS UIWebView 全屏播放视频, 需横屏,单app不支持横屏, 解决办法
- Mac 下Coursera无法播放视频的解决办法
- HI3518视频画面偏色解决办法小记
- 关于AVFoundation播放没有声音的解决办法
- Android之通过VideoView控件播放一个视频出现的问题以及我的解决办法
- Cousera 无法播放视频 解决办法 widows 和 linux
- Windows7系统播放网页视频没有声音的解决方法