【问题标题】:Python video has no sound when sent from whatsapp从whatsapp发送Python视频时没有声音
【发布时间】:2020-05-27 09:19:31
【问题描述】:

我在 iPhone 上从 Whatsapp 发送视频时遇到了一个特定问题(其他一切正常:Android、Windows 和 Mac 上的网络应用程序)。您可以在下面看到我的代码,每次我从 iPhone 上的 Whatsapp 应用程序发送我的视频时,它在 iPhone 设备上似乎没有声音,我会注意到,如果我通过驱动器发送相同的视频作为示例,它工作正常。

我还要补充一点,常规的 mp4 视频确实会带声音传输。 谢谢:)

with codecs.open(self.fileName + '.txt', 'r', encoding='utf8') as stampFile:
  for line in stampFile:
      if self.stop:
          return
      self.counter += 1
      time = line.split(";")
      currStart = timeClass.calculateTimeToSec(time[0])
      currEnd = timeClass.calculateTimeToSec(time[1])
      currStart = max(currStart, 0)
      currEnd = max(currEnd, 0)
      if currEnd <= currStart:
          return
      clip = VideoFileClip(self.mediaFilePath)
      if currStart >= clip.duration:
          return
      currStart = min(currStart, clip.duration - 1)
      currEnd = min(currEnd, clip.duration)
      clip = clip.subclip(currStart, min(currEnd, clip.duration))
      path = self.dirName + "\\BBrief-Clips" + "/BBrief-" + str(self.counter) + "-" + self.mediaFileName
        #threading.Thread(target=lambda: clip.write_videofile(path, codec='libx264')).start()
        clip.write_videofile(path, codec='libx264')
        if prevClip is None:
            prevClip = clip
            clip = fadeout(clip, 1)
        else:
            clip = clip.set_start(prevClip.end)
            clip = fadein(clip, 1)
            clip = fadeout(clip, 1)
            prevClip = clip
        clips.append(clip)
        duration += currStart - currEnd

    path = self.dirName + "\\Singel-BBrief" + "/BBrief-" + self.mediaFileName
    CompositeVideoClip(clips).write_videofile(path, codec='libx264')
    T.sleep(1)
    self.counter += 1
    for clip in clips:
        clip.close()

【问题讨论】:

    标签: python moviepy


    【解决方案1】:

    我设法通过将输出文件更改为 MOV 来解决此解决方案。

    path = self.dirName + "mediaFileName"[:-4]+".MOV"
        CompositeVideoClip(clips).write_videofile(path, codec='libx264')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-29
      • 2023-01-15
      • 2011-01-12
      • 1970-01-01
      • 2014-03-27
      • 1970-01-01
      相关资源
      最近更新 更多