久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <legend id='PZTjj'><style id='PZTjj'><dir id='PZTjj'><q id='PZTjj'></q></dir></style></legend>
    • <bdo id='PZTjj'></bdo><ul id='PZTjj'></ul>

      <small id='PZTjj'></small><noframes id='PZTjj'>

      <i id='PZTjj'><tr id='PZTjj'><dt id='PZTjj'><q id='PZTjj'><span id='PZTjj'><b id='PZTjj'><form id='PZTjj'><ins id='PZTjj'></ins><ul id='PZTjj'></ul><sub id='PZTjj'></sub></form><legend id='PZTjj'></legend><bdo id='PZTjj'><pre id='PZTjj'><center id='PZTjj'></center></pre></bdo></b><th id='PZTjj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PZTjj'><tfoot id='PZTjj'></tfoot><dl id='PZTjj'><fieldset id='PZTjj'></fieldset></dl></div>
      1. <tfoot id='PZTjj'></tfoot>

        Q媒體播放器.如何播放具有多個(gè)音頻的視頻?

        QMediaPlayer. How to play video with multiple audio?(Q媒體播放器.如何播放具有多個(gè)音頻的視頻?)
        <i id='Enpkb'><tr id='Enpkb'><dt id='Enpkb'><q id='Enpkb'><span id='Enpkb'><b id='Enpkb'><form id='Enpkb'><ins id='Enpkb'></ins><ul id='Enpkb'></ul><sub id='Enpkb'></sub></form><legend id='Enpkb'></legend><bdo id='Enpkb'><pre id='Enpkb'><center id='Enpkb'></center></pre></bdo></b><th id='Enpkb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Enpkb'><tfoot id='Enpkb'></tfoot><dl id='Enpkb'><fieldset id='Enpkb'></fieldset></dl></div>
          <bdo id='Enpkb'></bdo><ul id='Enpkb'></ul>

                <tbody id='Enpkb'></tbody>
              1. <tfoot id='Enpkb'></tfoot>

                <small id='Enpkb'></small><noframes id='Enpkb'>

                1. <legend id='Enpkb'><style id='Enpkb'><dir id='Enpkb'><q id='Enpkb'></q></dir></style></legend>
                  本文介紹了Q媒體播放器.如何播放具有多個(gè)音頻的視頻?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  有一個(gè)包含兩個(gè)音軌的視頻文件:

                  There is a video file with two audio tracks:

                    Duration: 01:05:09.12, start: 0.000000, bitrate: 2781 kb/s
                      Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1998 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
                      Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 384 kb/s
                      Stream #0:2: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 384 kb/s
                  

                  用這段代碼玩它:

                  self.player = QMediaPlayer()
                  self.player.setMedia(QMediaContent(QUrl.fromLocalFile(fileName)))
                  self.player.play()
                  

                  播放視頻和第一個(gè)音軌.Н如何切換到第二個(gè)音軌?

                  Video and first audio track is played. Нow to switch to the second audio track?

                  推薦答案

                  正如@musicamante 在評(píng)論中指出的那樣,解決方案是訪問(wèn) QMediaStreamsControl 但 PyQt5 沒(méi)有公開它.

                  As @musicamante points out in the comments, the solution is to access the QMediaStreamsControl but PyQt5 does not expose it.

                  相反,PySide2 確實(shí)公開了它,解決方案是使用 shiboken2 進(jìn)行投射:

                  Instead PySide2 does expose it and the solution is to cast using shiboken2:

                  import os
                  
                  from PySide2 import QtCore, QtWidgets, QtMultimedia, QtMultimediaWidgets
                  
                  import shiboken2
                  
                  
                  class MainWindow(QtWidgets.QMainWindow):
                      def __init__(self, parent=None):
                          super(MainWindow, self).__init__(parent)
                          video_widget = QtMultimediaWidgets.QVideoWidget()
                          self.player = QtMultimedia.QMediaPlayer(
                              self, QtMultimedia.QMediaPlayer.VideoSurface
                          )
                          file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test5.mkv")
                          self.player.setMedia(
                              QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile(file))
                          )
                          self.player.setVideoOutput(video_widget)
                          self.player.play()
                          self.setCentralWidget(video_widget)
                  
                          control = self.player.service().requestControl(
                              "org.qt-project.qt.mediastreamscontrol/5.0"
                          )
                          qptr = shiboken2.getCppPointer(control)[0]
                          self.qcontrol = shiboken2.wrapInstance(qptr, QtMultimedia.QMediaStreamsControl)
                          self.resize(640, 480)
                  
                      def contextMenuEvent(self, event):
                          menu = QtWidgets.QMenu()
                          group = QtWidgets.QActionGroup(menu)
                          group.setExclusive(True)
                          index = 0
                          for i in range(self.qcontrol.streamCount()):
                              t = self.qcontrol.streamType(i)
                              if t == QtMultimedia.QMediaStreamsControl.AudioStream:
                                  action = menu.addAction("Audio-{}".format(index))
                                  action.setCheckable(True)
                                  if self.qcontrol.isActive(i):
                                      action.setChecked(True)
                                  action.setData(i)
                                  menu.addAction(action)
                                  index += 1
                          action = menu.exec_(self.mapToGlobal(event.pos()))
                          if action is not None:
                              i = action.data()
                              self.qcontrol.setActive(i, True)
                  
                  
                  if __name__ == "__main__":
                      import sys
                  
                      app = QtWidgets.QApplication(sys.argv)
                      w = MainWindow()
                      w.show()
                      sys.exit(app.exec_())
                  

                  在 pyqt5 的情況下,您應(yīng)該使用 sip 和以下代碼:

                  In the case of pyqt5 you should use sip with the following code:

                  import os
                  
                  from PyQt5 import QtCore, QtWidgets, QtMultimedia, QtMultimediaWidgets
                  
                  import sip
                  
                  
                  class MainWindow(QtWidgets.QMainWindow):
                      def __init__(self, parent=None):
                          super(MainWindow, self).__init__(parent)
                          video_widget = QtMultimediaWidgets.QVideoWidget()
                          self.player = QtMultimedia.QMediaPlayer(
                              self, QtMultimedia.QMediaPlayer.VideoSurface
                          )
                          file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test5.mkv")
                          self.player.setMedia(
                              QtMultimedia.QMediaContent(QtCore.QUrl.fromLocalFile(file))
                          )
                          self.player.setVideoOutput(video_widget)
                          self.player.play()
                          self.setCentralWidget(video_widget)
                  
                          control = self.player.service().requestControl(
                              "org.qt-project.qt.mediastreamscontrol/5.0"
                          )
                          self.qcontrol = sip.cast(control, QtMultimedia.QMediaStreamsControl)
                          self.resize(640, 480)
                  
                      def contextMenuEvent(self, event):
                          menu = QtWidgets.QMenu()
                          group = QtWidgets.QActionGroup(menu)
                          group.setExclusive(True)
                          index = 0
                          for i in range(self.qcontrol.streamCount()):
                              t = self.qcontrol.streamType(i)
                              if t == QtMultimedia.QMediaStreamsControl.AudioStream:
                                  action = menu.addAction("Audio-{}".format(index))
                                  action.setCheckable(True)
                                  if self.qcontrol.isActive(i):
                                      action.setChecked(True)
                                  action.setData(i)
                                  menu.addAction(action)
                                  index += 1
                          action = menu.exec_(self.mapToGlobal(event.pos()))
                          if action is not None:
                              i = action.data()
                              self.qcontrol.setActive(i, True)
                  
                  
                  if __name__ == "__main__":
                      import sys
                  
                      app = QtWidgets.QApplication(sys.argv)
                      w = MainWindow()
                      w.show()
                      sys.exit(app.exec_())
                  

                  但正如 QMediaStreamsControl 所指出的,PyQt5 中不可用,因此解決方案是公開它,為此您必須:

                  But as pointed out by QMediaStreamsControl is not available in PyQt5, so a solution is to expose it and for this you must:

                  1. 下載 PyQt5 源碼:https://pypi.python.org/packages/source/P/PyQt5/PyQt5-5.14.2.tar.gz
                  2. 在 PyQt5 源代碼的sip/QtMultimedia"文件夾中創(chuàng)建文件 qmediastreamscontrol.sip.

                  1. Download PyQt5 source code: https://pypi.python.org/packages/source/P/PyQt5/PyQt5-5.14.2.tar.gz
                  2. Create the file qmediastreamscontrol.sip in "sip/QtMultimedia" folder of the PyQt5 source code.

                  qmediastreamscontrol.sip

                  class QMediaStreamsControl : QMediaControl
                  {
                  %TypeHeaderCode
                  #include <qmediastreamscontrol.h>
                  %End
                  
                  public:
                      enum StreamType { 
                          UnknownStream, 
                          VideoStream, 
                          AudioStream, 
                          SubPictureStream, 
                          DataStream 
                      };
                  
                      virtual ~QMediaStreamsControl();
                      virtual int streamCount() = 0;
                      virtual QMediaStreamsControl::StreamType streamType(int streamNumber) = 0;
                      virtual QVariant metaData(int streamNumber, const QString &key) = 0;
                      virtual bool isActive(int streamNumber) = 0;
                      virtual void setActive(int streamNumber, bool state) = 0;
                  
                  signals:
                      void streamsChanged();
                      void activeStreamsChanged();
                  
                  protected:
                  %If (Qt_5_6_1 -)
                      explicit QMediaStreamsControl(QObject *parent /TransferThis/ = 0);
                  %End
                  %If (- Qt_5_6_1)
                      QMediaStreamsControl(QObject *parent /TransferThis/ = 0);
                  %End
                  };
                  

                2. %Include qmediastreamscontrol.sip 添加到文件 sip/QtMultimedia/QtMultimediamod.sip 的末尾

                3. Add %Include qmediastreamscontrol.sip to the end of file sip/QtMultimedia/QtMultimediamod.sip

                  使用修改后的源代碼編譯安裝PyQt5.

                  Compile and install PyQt5 using the modified source code.

                  總結(jié):

                  • 如果你使用 pyside2 解決方案很簡(jiǎn)單.

                  • If you use pyside2 the solution is simple.

                  如果你使用 pyqt5,你將不得不修改它的源代碼,編譯并安裝它.希望 @musicamante 報(bào)告類 QMediaStreamsControl 在 pyqt5 的未來(lái)版本中公開

                  If you use pyqt5 you will have to modify its source code, compile it and install it. Hopefully with the @musicamante report class QMediaStreamsControl is exposed in future releases of pyqt5

                  這篇關(guān)于Q媒體播放器.如何播放具有多個(gè)音頻的視頻?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!
                4. 相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動(dòng)后進(jìn)度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動(dòng)時(shí),yaxis 刻度標(biāo)簽應(yīng)該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時(shí)顯示進(jìn)度條?)

                    • <small id='NgMz7'></small><noframes id='NgMz7'>

                      <legend id='NgMz7'><style id='NgMz7'><dir id='NgMz7'><q id='NgMz7'></q></dir></style></legend>
                        <bdo id='NgMz7'></bdo><ul id='NgMz7'></ul>
                          1. <tfoot id='NgMz7'></tfoot>
                              <tbody id='NgMz7'></tbody>
                            <i id='NgMz7'><tr id='NgMz7'><dt id='NgMz7'><q id='NgMz7'><span id='NgMz7'><b id='NgMz7'><form id='NgMz7'><ins id='NgMz7'></ins><ul id='NgMz7'></ul><sub id='NgMz7'></sub></form><legend id='NgMz7'></legend><bdo id='NgMz7'><pre id='NgMz7'><center id='NgMz7'></center></pre></bdo></b><th id='NgMz7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NgMz7'><tfoot id='NgMz7'></tfoot><dl id='NgMz7'><fieldset id='NgMz7'></fieldset></dl></div>
                          2. 主站蜘蛛池模板: 999久久久 | 日韩成人免费视频 | 麻豆久久久9性大片 | 国产一区二区激情视频 | 在线免费观看一区二区 | 精精国产xxxx视频在线 | 国产成人一区二区 | 午夜久久久 | 日本高清aⅴ毛片免费 | 精品国产区 | 欧产日产国产精品国产 | 亚洲午夜av久久乱码 | 黄色免费观看网站 | 操亚洲| 人人擦人人 | 午夜一区| 久久久久久亚洲 | 999精品视频在线观看 | 国产精品日韩欧美 | 亚av在线| 国产精品久久久久久久久久免费 | 国产精品久久久久久久久久免费看 | 国产黑丝av| 久久久夜色精品亚洲 | 成人在线视频网站 | 成人久久久 | 午夜精品久久久久久久99黑人 | 国产激情第一页 | 奇米久久久 | 国产精品久久久久久久久免费樱桃 | 午夜成人在线视频 | 欧美高清视频在线观看 | 极品粉嫩国产48尤物在线播放 | 国产在线精品一区二区三区 | 国产视频一区二区三区四区五区 | 日韩三级电影在线看 | 国产高清无av久久 | 亚洲国产电影 | 亚洲精品久久久9婷婷中文字幕 | 亚洲精品一区二区网址 | 成人在线精品 |