PyQt多媒体持续时间翻倍

时间:2020-10-15 08:35:59

标签: python pyqt5 qtmultimedia

from PyQt5 import QtCore, QtGui, QtWidgets, QtMultimedia
import sys
import time
from mutagen.mp3 import MP3


class PlayMp3(object):
    def __init__(self):
        filename = "Αθήνα 14-10-2020 export.mp3"
        url = QtCore.QUrl.fromLocalFile(r""+filename)
        content = QtMultimedia.QMediaContent(url)
        self.player = QtMultimedia.QMediaPlayer()
        self.player.durationChanged.connect(lambda position:print(self.player.duration()))
        self.player.setMedia(content)
        
        
        
        self.player.play()
        
        audio = MP3(filename)
        print(audio.info.length)

        
app = QtWidgets.QApplication(sys.argv)
app.addLibraryPath(r"C:/Users/Χρήστος/AppData/Local/Programs/Python/Python38/Lib/site-packages/pyqt5_tools/Qt/plugins")
app.addLibraryPath(r"C:/Users/Χρήστος/AppData/Local/Programs/Python/Python38/lib/site-packages/PyQt5/Qt/plugins")
MainWindow = QtWidgets.QMainWindow()
ui = PlayMp3()
MainWindow.showMaximized()
sys.exit(app.exec_())

Output: 78.10612244897959 156243

因此,文件听起来像预期的01:20。 156243是什么意思?

由于某种原因,我认为它使时间加倍。

任何帮助都是有用的。

enter image description here

0 个答案:

没有答案