Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Again::How Show a Subtitle on QMediaPlayer?
Qt 6.11 is out! See what's new in the release blog

Again::How Show a Subtitle on QMediaPlayer?

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 9.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Unfortunately QMediaPlayer doesn't seems to support subtitles yet.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ElboyQt
        wrote on last edited by
        #3

        U can use "QGraphicsVideoItem":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html and upper QGraphicsItem where your text can be displayed.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          [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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            post #1 updated!!
            please help

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ElboyQt
              wrote on last edited by
              #6
              1. U can call "QGraphicsVideoItem::setSize":http://qt-project.org/doc/qt-5/qgraphicsvideoitem.html#size-prop method every time when QGraphicsView resizes.

              2. What videos can not be played?

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  [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.

                  1. 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!
                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    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

                    1 Reply Last reply
                    1
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #10

                      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!

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #11

                        On Ubuntu (Linux) Qt Multimidia uses GStreamer. - It might be the encoding of the video or the video isn't supported itself.

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #12

                          [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

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #13

                            anybody?!

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved