Again::How Show a Subtitle on QMediaPlayer?
-
Hello everybody.
i developing an app and i need to lay video with subtitle
the mediaplayer section is completed, but i dont know how show subtitle or *any text *on it!
so, how can i do it?Update1::
i used QGraphicVideoItem and it works for showing subtitle with QGraphicTextItem ,
but it has 2 major problem:
1.against VideoWidget, the size is fixed.
i mean with VideoWidget, every video has a size but in QGraphicVideoItem its fixed
and not changed with changing window size.
2.against VideoWidget it can not play all the videos.so, anybody has anything?
-
U can use "QGraphicsVideoItem":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html and upper QGraphicsItem where your text can be displayed.
-
[quote author="ElboyQt" date="1414135036"]U can use "QGraphicsVideoItem":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html and upper QGraphicsItem where your text can be displayed.[/quote]
Solved, thanks a lot
-
post #1 updated!!
please help -
-
U can call "QGraphicsVideoItem::setSize":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html#size-prop method every time when QGraphicsView resizes.
-
What videos can not be played?
-
-
Hi, I am an expert now on this subject, I have developed the same thing and I used the video surface for drawing subtitles.
So I create an algorithm that parse the srt file and draw subtitles on videsurface.(resize is automatic)
You can exploit the custom video surface example and draw on that paint method.Furthermore I have created an object inside the QVideoWidget so, you can set in player->setOutputVideo(videoWidget->videoSurface()).
For video support you can switch the engine to directx. -
[quote author="alexRM" date="1414754749"]Hi, I am an expert now on this subject, I have developed the same thing and I used the video surface for drawing subtitles.
So I create an algorithm that parse the srt file and draw subtitles on videsurface.(resize is automatic)
You can exploit the custom video surface example and draw on that paint method.Furthermore I have created an object inside the QVideoWidget so, you can set in player->setOutputVideo(videoWidget->videoSurface()).
For video support you can switch the engine to directx.
[/quote]
What?! :D
i didn't understand at all!
im a newbie in this thing, please say it for amateurs :D
thanks a lot[quote author="ElboyQt" date="1414751323"]1. U can call "QGraphicsVideoItem::setSize":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html#size-prop method every time when QGraphicsView resizes.
- What videos can not be played?[/quote]
1.using setsize just set the size for once and not changed like VideoWidget
if i get it wrong, please tell me, thanks
2.i really dont know!
it not depends on size or bitrate or pixel
so, i dont know why can not open some of them!
- What videos can not be played?[/quote]
-
bq. Qt Multimedia features for Windows are implemented in two plugins; one using the Microsoft DirectShow API, and another using WMF (Windows Media Foundation) framework. DirectShow API was introduced in Windows 98, and gradually deprecated from Windows XP onwards. Media Foundation framework was introduced in Windows Vista as a replacement for DirectShow and other multimedia APIs. Consequently, WMF plugin in Qt is supported only for Windows Vista and later versions of the operating system. - "Qt Multimedia on Windows":http://qt-project.org/doc/qt-5/qtmultimedia-windows.html
Per default MSVC compiler compiles using WMF (Windows Media Foundation) and unfortunately it's really limited when talking about formats. You can see the list "here":http://bit.ly/1E8x9N1
If you notice you can't execute mkv, flv, rmvb and others common formats. There's others alternatives that you can try such as MPlayer, QtAV, VLC-Qt.
Searching for how to run other formats you can see this information on Microsoft's FAQ:
bq. Windows Media Player includes some of the most popular codecs, like MP3, Windows Media Audio, and Windows Media Video, but it doesn't include the codecs required for Blu‑ray Discs, FLAC files, or FLV files. If something isn’t working with Windows Media Player, you might not have the right codec on your PC. The easiest way to solve the problem is to go online and search for the codec you need.
bq. Warning
You should only install codecs, filters, or plug-ins from trusted, authorized sources, such as the official website of the codec manufacturer. Be careful when you install codecs that you've found on the Internet, particularly the free codec packs that claim to include codecs from many companies, because these codec packs might include software that can damage your PC. If you've installed any codec packs and are having problems with the Player, we recommend that you remove them.Resuming: Windows 7 or later supports most modern video and audio codecs and container formats. However it doesn’t support Matroska video files as it doesn’t have native mkv splitter.
For unknown reasons even if you install codecs Qt Multimidia still not running those formats.
You can compile using MinGW that will switch to DirectX. If you are in a 64bit operating system, you can use Mingw-w64. - "see more...":http://qt-project.org/wiki/MinGW-64-bit
-
actually i using ubuntu.
thanks for explaining, but it not depends on format either.
because i can play mkv, avi, mp4 ,etc. but just some of them cant play!
thats the odd thing! -
[quote author="vivinonoc" date="1414773288"]On Ubuntu (Linux) Qt Multimidia uses GStreamer. - It might be the encoding of the video or the video isn't supported itself.[/quote]
thanks, but gstreamer fully installed and it can open the videos with videoWidget!
so dont think so that be the problem -
anybody?!