将 ffmpeg 与 Python 2.7 结合使用

2024-01-11

我一直尝试在 Python 2.7 中安装 pyffmpeg 但没有成功。我找到了一个 Python 2.6 的包,但我无法让它工作。所以,我一直在考虑2.7。我在这个网站上看过其他人之前的帖子,但他们没有帮助。有人对此有经验吗。最终,我想开发一个转换视频格式的wxPython应用程序。谢谢

我最终编写的对我有用的代码(非常基本,但它有效......):

import wx
import os
import sys
import time
import datetime
from wx.lib.delayedresult import startWorker



class dConvert(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'd-Converter', size=(500, 310))
        panel = wx.Panel(self, wx.ID_ANY)#Creates a panel over the widget
        toolbar = self.CreateToolBar()
        toolbar.Realize()

        #Setup Menu
        #Setting up Menu
        menuFile = wx.Menu()
        menuFile.Append(1, "&About...")
        menuFile.AppendSeparator()
        menuFile.Append(2, "E&xit")
        menuBar = wx.MenuBar()
        menuBar.Append(menuFile, "&File")

        panel.SetBackgroundColour('WHITE')

        menu2 = wx.Menu()
        menu2.Append(5, "&.mpg to dvd", ".mpg to dvd")
        menu2.AppendSeparator()
        menu2.Append(wx.NewId(), "&Options...", "Options...")
        menuBar.Append(menu2, "&DVD")


        menu3 = wx.Menu()
        menu3.Append(7, "&Audio/Video Trim")
        #menu3.AppendSeparator()
        menuBar.Append(menu3, "Media")

        self.SetMenuBar(menuBar)
        self.Bind(wx.EVT_MENU, self.OnAbout, id=1)
        self.Bind(wx.EVT_MENU, self.OnQuit, id=2)
        self.Bind(wx.EVT_MENU, self.OnDVD, id=5)
        self.Bind(wx.EVT_MENU, self.OnMedia, id=7)

        #Add icon to frame
        iconFile = "dconverter_image.jpg"
        icon1 = wx.Icon(iconFile, wx.BITMAP_TYPE_JPEG)
        self.SetIcon(icon1)


        self.statusbar = self.CreateStatusBar()
        self.statusbar.SetStatusText("Convert Audio & Video")
        self.statusbar.SetFieldsCount(3)
        self.statusbar.SetStatusWidths([200, -2, -2])



        #Panel Text
        font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        font2 = wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        directory = wx.StaticText(panel, -1, 'Path: c:\\ffmpeg\\bin', (300, 13))
        directory.SetFont(font2)

        convertfile = wx.StaticText(panel, -1, 'File:', (270, 53))
        convertfile.SetFont(font)

        convertfile2 = wx.StaticText(panel, -1, 'Format:', (245, 83))
        convertfile2.SetFont(font)

        convertfile3 = wx.StaticText(panel, -1, 'Quality:', (244, 113))
        convertfile3.SetFont(font)

        convertfile4 = wx.StaticText(panel, -1, 'Presets:', (239, 143))
        convertfile4.SetFont(font)

        image_file = 'cd_rom.gif'
        bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        panel.bitmap1 = wx.StaticBitmap(panel, -1, bmp1, (50, 30))



        self.formats1 = []


        #Select Media path    
        os.chdir("c:\\ffmpeg\\bin")
        wrkdir = os.getcwd()
        filelist = os.listdir(wrkdir)
        #self.formats1 = []

        for filename in filelist:
            (head, filename) = os.path.split(filename)
            if filename.endswith(".avi") or filename.endswith(".mp4") or filename.endswith(".mpg") or filename.endswith(".m4A") or filename.endswith(".MTS") or filename.endswith(".flv") or filename.endswith(".mov") or filename.endswith(".mpeg4") or filename.endswith(".mpeg") or filename.endswith(".mpg2") or filename.endswith(".mkv") or filename.endswith(".m4v") or filename.endswith(".wav") or filename.endswith(".mp3"):
            self.formats1.append(filename)


        self.format_combo1=wx.ComboBox(panel, size=(140, -1),value='Select Media', choices=self.formats1, style=wx.CB_DROPDOWN, pos=(300,50)) 
        self.Bind(wx.EVT_COMBOBOX, self.fileFormats, self.format_combo1)


        #Media Formats
        self.formats2 = ['Select Format', '.avi','.mpeg','.mp4','.flv','.mov','.m4a','.m4v','.mkv','.mpeg4','.mpg','.mpg2','.mp3','.ogg','.wav','.wma']

        self.format_combo2=wx.ComboBox(panel, size=(100, -1),value='Select Format', choices=self.formats2, style=wx.CB_SORT, pos=(300,81))

        #Media Quality
        self.formats3 = ['-sameq','-qmax']
        self.format_combo3=wx.ComboBox(panel, size=(100, -1),value='Select Quality', choices=self.formats3, style=wx.CB_DROPDOWN, pos=(300,111))



        #-qmax settings
        self.formats4 = ['1','2','3','4','5','6','7','8']
        self.format_combo4=wx.ComboBox(panel, size=(30, -1),value='0', choices=self.formats4, style=wx.CB_DROPDOWN, pos=(405,111))
        self.format_combo4.Disable()


        #Media Quality
        self.formats5 = ['Select Preset','video to mp3']
        self.format_combo5=wx.ComboBox(panel, size=(100, -1),value='Select Preset', choices=self.formats5, style=wx.CB_DROPDOWN, pos=(300,141))

        #Bit rate
        self.formats6 = ['128000', '160000', '180000', '192000']
        self.format_combo6=wx.ComboBox(panel, size=(47, -1),value='k/bs', choices=self.formats6, style=wx.CB_DROPDOWN, pos=(405,141))
        self.format_combo6.Disable()






        #Convert Button
        self.button = wx.Button(panel, label="Convert", pos=(300, 171), size=(80, 20))
        self.Bind(wx.EVT_BUTTON, self.convertButton, self.button)

        #Abort Button
        self.button2 = wx.Button(panel, label="Abort", pos=(385, 171), size=(80, 20))
        self.Bind(wx.EVT_BUTTON, self.OnAbortButton, self.button2)
        self.button2.Disable()

        #Refresh Button
        self.button3 = wx.Button(panel, label="Refresh", pos=(215, 171), size=(80, 20))
        self.Bind(wx.EVT_BUTTON, self.file_refresh, self.button3)


        #ComboBox Event
        self.Bind(wx.EVT_COMBOBOX, self.OncomboBox, self.format_combo3)
        self.Bind(wx.EVT_COMBOBOX, self.OncomboBox2, self.format_combo5)
        self.Bind(wx.EVT_COMBOBOX, self.OncomboBox3, self.format_combo2)



    def file_refresh(self, e):
        self.format_combo1.Clear()
        os.chdir("c:\\ffmpeg\\bin")
        wrkdir = os.getcwd()
        filelist = os.listdir(wrkdir)
        for m_files in filelist:
            if m_files.endswith(".avi") or m_files.endswith(".mp4") or m_files.endswith(".mpg") or m_files.endswith(".m4A") or m_files.endswith(".MTS") or m_files.endswith(".flv") or m_files.endswith(".mov") or m_files.endswith(".mpeg4") or m_files.endswith(".mpeg") or m_files.endswith(".mpg2") or m_files.endswith(".mkv") or m_files.endswith(".m4v") or m_files.endswith(".wav") or m_files.endswith(".mp3"):
            self.format_combo1.Append(m_files)



    def file_rename(self, f_name):
        ts = time.time()
        #Capture readable timestamp
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H-%M-%S')
        os.chdir("c:\\ffmpeg\\bin")
        wrkdir = os.getcwd()

        #get file extenstion from original file
        #fileName, fileExtension = os.path.splitext(wrkdir + '\\' + f_name)

        #add file extension to timestamp
        new_file = st 

        return new_file



    def fileFormats(self, e):
        myFormats = {'audio': ('Select Format', '.m4a', '.mp3', '.ogg', '.wav', '.wma'), 'video': ('Select Format', '.avi', '.flv', '.mkv', '.m4v', '.mov', '.mpg', '.mpg2', '.mpeg4', '.mp4', '.mpeg')}
        bad_file = ['Media not supported']
        myFile = self.format_combo1.GetValue()
        f_exten = (x for x in myFormats['audio'] + myFormats['video'] if myFile.endswith(x))
    extension = f_exten.next()

        if extension in myFormats['audio']:
            self.format_combo2.SetItems(myFormats['audio'])

        elif extension in myFormats['video']:
            self.format_combo2.SetItems(myFormats['video'])
        else:
            self.format_combo2.SetItems(bad_file)


    def OnQuit(self, event):
        self.Close(True)

    def OnAbout(self, event):
        wx.MessageBox("d-Converter 1.0\n\n Developer: D.Monroe\n\nCopyright 2012",
                "About d-Converter", wx.OK | wx.ICON_INFORMATION, self)


    def OncomboBox(self, e):
        quality=self.format_combo3.GetValue()
        if quality == '-qmax':
            self.format_combo4.Enable()

        else:
            self.format_combo4.Disable()



    def OncomboBox2(self, e):
        quality=self.format_combo5.GetValue()
        if quality != 'Select Preset':
            self.format_combo1.Enable()
            self.format_combo2.Disable()
            self.format_combo3.Disable()
            self.format_combo4.Disable()
            self.format_combo6.Enable()

        elif quality == 'Select Preset':
            self.format_combo1.Enable()
            self.format_combo2.Enable()
            self.format_combo3.Enable()
            self.format_combo4.Disable()
            self.format_combo5.Enable()
            self.format_combo6.Disable()

        elif quality == 'video to mp3':
            self.format_combo6.Enable()
            self.format_combo2.Disable()
            self.format_combo3.Disable()
            self.format_combo4.Disable()

    def OncomboBox3(self, e):
        v_format=self.format_combo2.GetValue()
        if v_format != 'Select Format':
            self.format_combo1.Enable()
            self.format_combo2.Enable()
            self.format_combo3.Enable()
            self.format_combo4.Enable()
            self.format_combo5.Disable()
            self.format_combo6.Disable()

        elif v_format == 'Select Format':
            self.format_combo1.Enable()
            self.format_combo2.Enable()
            self.format_combo3.Enable()
            self.format_combo4.Disable()
            self.format_combo5.Enable()
            self.format_combo6.Disable()





    def OnMedia(self, e):
        pass

    def OnDVD(self, e):
        """ Select a directory to search"""
        os.chdir("c:\\ffmpeg\\bin")
        wrkdir = os.getcwd()
        filelist = os.listdir(wrkdir)
        progdir = 'c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '
        prog_dir = ' -target '
        progdir3 = '-dvd -ac 2 '
        vid_format = '.mpg'


        sampleList = []
        for filename in filelist:
           (head, filename) = os.path.split(filename)
           if filename.endswith(".avi") or filename.endswith(".flv") or filename.endswith(".mpeg") or filename.endswith(".mp4") or filename.endswith(".mov") or filename.endswith(".mpg2"):
            sampleList.append(filename)

        dlg = wx.SingleChoiceDialog(
               self, "Files in c:\\ffmpeg\\bin", 'Select video to convert',
           sampleList,
           wx.CHOICEDLG_STYLE
           )

        if dlg.ShowModal() == wx.ID_OK:
            cur_item = dlg.GetStringSelection()
            s_string = cur_item
            #f_string = self.file_rename(s_string)
            f_string = s_string.replace(' ', '')





        dlg.Destroy()


        dlg2 = wx.SingleChoiceDialog(
               self, "Files in c:\\ffmpeg\\bin", 'Select video standard ',
           ["pal", "ntsc"],
           wx.CHOICEDLG_STYLE
           )

        if dlg2.ShowModal() == wx.ID_OK:
            cur_item2 = dlg2.GetStringSelection()
            s_string2 = cur_item2
            self.button.Disable()
            self.button2.Enable()
            self.format_combo1.Disable()
            self.format_combo2.Disable()
            self.format_combo3.Disable()
            self.format_combo4.Disable()
            self.format_combo5.Disable()
            self.format_combo6.Disable()
            startWorker(self.LongTaskDone, self.LongTask4, wargs=(progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format))


        dlg2.Destroy()






    def convertButton(self, e):
        unit1 = self.format_combo1.GetValue()
        unit2 = self.format_combo2.GetValue()
        unit3 = self.format_combo3.GetValue()
        unit4 = None
        unit5 = self.format_combo5.GetValue()
        bitRate = self.format_combo6.GetValue()
        unit6 = bitRate
        if unit3 == '-qmax':
            unit4 = self.format_combo4.GetValue()
        else:
            pass

        os.chdir("c:\\ffmpeg\\bin")
        wrkdir = os.getcwd()

        newfile = unit1



        #stripped = os.path.splitext(newfile)[0] # Updated 9/26/2013 to strip extension.
        #stripped = newfile.strip('mpeg3kaviovfl4w2c.') #Strips the extension from the original file name
        stripped = self.file_rename(newfile)

        #os.rename(newfile, newfile_f)



        progname='c:\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '

        preset1_a='-vn -ar 44100 -ac 2 -ab'
        preset1_b='-f mp3 '
        preset_mp3='.mp3'







         if (unit1 == 'Select Media' or unit1 == ''):
                    amsg = wx.MessageDialog(None, 'You must select a media file!', 'Media Converter', wx.ICON_INFORMATION)
                    amsg.ShowModal()
                    amsg.Destroy()



         elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'Select Preset'):

             if (unit2 == 'Select Format' or unit2 == ''):
                amsg = wx.MessageDialog(None, 'You must select a format', 'Media Converter', wx.ICON_INFORMATION)
                amsg.ShowModal()
                amsg.Destroy()

                self.format_combo3.Enable()
                self.format_combo4.Enable()
                self.format_combo5.Enable()

            else:
                pass

            if (unit3 == 'Select Quality' or unit3 == ''):
                amsg = wx.MessageDialog(None, 'You must select quality', 'Media Converter', wx.ICON_INFORMATION)
                amsg.ShowModal()
                amsg.Destroy()


            elif (unit3 == '-qmax'):
                if (unit4 == '0' or unit4 == ''):
                    amsg = wx.MessageDialog(None, 'You must select number between 1-8.', 'Media Converter', wx.ICON_INFORMATION)
                    amsg.ShowModal()
                    amsg.Destroy()
                else:
                    self.button.Disable()
                    self.button2.Enable()
                    pass

            else:
                self.button.Disable()
                self.button2.Enable()
                self.format_combo1.Disable()
                self.format_combo2.Disable()
                self.format_combo3.Disable()
                self.format_combo4.Disable()
                startWorker(self.LongTaskDone, self.LongTask, wargs=(progname,wrkdir,unit1,unit3,stripped,unit2))





        elif (unit1 != 'Select Media' or unit1 != '') and (unit5 == 'video to mp3'):
            if unit6 == 'k/bs' or unit6 == None:
                amsg = wx.MessageDialog(None, 'You must select a bit rate.', 'Media Converter', wx.ICON_INFORMATION)
                amsg.ShowModal()
                amsg.Destroy()

            else:
                self.button.Disable()
                self.button2.Enable()
                self.format_combo1.Disable()
                self.format_combo2.Disable()
                self.format_combo3.Disable()
                self.format_combo4.Disable()
                self.format_combo5.Disable()
                self.format_combo6.Disable()
                startWorker(self.LongTaskDone, self.LongTask3, wargs=(progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3))











    def LongTask(self, progname, wrkdir, unit1, unit3, stripped, unit2):
        convert_file1 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + stripped + unit2
        self.statusbar.SetStatusText("Converting: " + unit1 + "...")
        os.system(convert_file1)
        print convert_file1





    def LongTask2(self, progname, wrkdir, unit1, unit3, unit4, stripped, unit2):
        convert_file2 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + unit4 + ' ' + stripped + unit2
        self.statusbar.SetStatusText("Converting: " + unit1 + "...")
        os.system(convert_file2)


    def LongTask3(self, progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3):
        convert_file3 = progname + wrkdir + '\\' + unit1 + ' ' + preset1_a + ' ' + unit6 + ' ' + preset1_b + stripped + preset_mp3
        self.statusbar.SetStatusText("Converting: " + unit1 + "...")
        os.system(convert_file3)

    def LongTask4(self, progdir, wrkdir, prog_dir, progdir3, f_string, s_string2, vid_format):
        #convert_file4 = progdir + wrkdir + '\\' + s_string + prog_dir + s_string2 + progdir3 + s_string.strip('mpegaviw24ofl.') + vid_format
        convert_file4 = progdir + f_string + prog_dir + s_string2 + progdir3 + f_string.strip('mpegaviw24ofl.') + vid_format
        self.statusbar.SetStatusText("Converting: " + f_string + "...")
        os.system(convert_file4)
        print convert_file4



    def LongTaskDone(self, result):
        r = result.get()
        if r:
            amsg = wx.MessageDialog(None, 'Aborted!', 'Media Converter', wx.ICON_INFORMATION)
            self.statusbar.SetStatusText("Convert Aborted ...")
            amsg.ShowModal()
            amsg.Destroy()
            self.LongTask.terminate()
        else:
            self.statusbar.SetStatusText("Done ...")
            emsg = wx.MessageDialog(None, 'Finished Converting!', 'Media Converter', wx.ICON_INFORMATION)
            emsg.ShowModal()
            emsg.Destroy()
            self.format_combo1.Enable()
            self.format_combo2.Enable()
            self.format_combo3.Enable()
            self.format_combo5.Enable()
            self.format_combo4.Disable()
            self.format_combo6.Disable()
            self.button.Enable()
            self.button2.Disable()
            self.shouldAbort = False
        """self.progress_bar.SetValue(0)
        self.progress_bar.Hide()"""



    def OnAbortButton(self, e):
        endprogram = 'c:\\Windows\\System32\\taskkill /IM cmd.exe'
        os.system(endprogram)
        self.format_combo1.Enable()
        self.format_combo2.Enable()
        self.format_combo3.Enable()
        self.format_combo5.Enable()
        self.button.Enable()




if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = dConvert()
    frame.SetSizeHints(500,310,500,310)
    frame.Show()
    app.MainLoop()

由于这个问题没有正确的答案,所以我想提出一个。不幸的是 pyffmpeg 包装器无法执行视频编码。因此,作为解决方案,我建议您使用一些替代的 python 包装器,它能够满足我们对视频进行编码的需要。

  • Python视频转换器 https://github.com/senko/python-video-converter
  • FFmpeg包装器 http://pythonhosted.org/ffmpegwrapper/
  • FFVideo https://bitbucket.org/zakhar/ffvideo/overview

除此之外,您还可以使用 python 来使用完整的 FFmpeg 功能subprocess执行完整 FFmpeg 命令的模块。如果需要的话,您还可以创建自己的包装器。Here http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/Zulko 描述了一种很好的使用方法subprocess使用 FFmpeg。有时你会遇到一些令人困惑的事件,例如this https://stackoverflow.com/questions/30785774/ffmpeg-unrecognized-option-map-outv使用时subprocess。但总有解决办法!

希望这可以帮助那些使用 ffmpeg 编码视频遇到同样问题的人!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将 ffmpeg 与 Python 2.7 结合使用 的相关文章

  • FFmpeg 转换错误

    我正在尝试使用 FFmpeg 将视频转换为 webm 格式 我已经安装了此处列出的所有依赖项 http www videochat scripts com install ffmpeg mplayer flvtool2 yamdi x264
  • pkg-config 无法在 ffmpeg 构建上找到库(linux)

    我正在尝试在 ubuntu 上为 android 构建 ffmpeg I ve cross compiled all the dependencies I need for my configuration I ve set up the
  • 在 OSX“El Capitan”上安装 wxPython 2.8(用于骑行)

    我正在尝试安装 wxPython 2 8 unicode 版本 以便能够使用 robotsframework ride 到目前为止 从网站下载的安装程序失败 并显示错误 没有可安装的软件 并且使用Brew安装3 0版本 与ride不兼容 我
  • 使用 Python 从原始帧创建 MPEG4 视频文件

    我有一个原始视频帧源 我可以在 Python 中访问它 我想用它创建一个 MPEG4 视频 并带有 MP3 背景音乐 Python 中有哪些类型的工具和库可用于此类任务 最好我想要一个 API 我可以为其提供输出文件名 然后将各个帧作为 2
  • ffmpeg drawtext如何设置从右到左的方向

    i write arabic text to videos and it works fine but the issue is that the arabic language is written from right to left
  • ffmpeg 使用 -movflags faststart

    我尝试使用命令 movflags 快速启动 并得到以下错误 Microsoft Windows 版本 6 0 6002 版权所有 c 2006 Microsoft 公司 版权所有 C uploads 1 videos gt ffmpeg i
  • 使用 ffmpeg 转换真实媒体

    我有许多旧的硬壳真实媒体文件需要转换 并希望编写一个脚本来批量处理它们 我可以使用 FFMpegX 进行 Real Media gt AVI 转换 但是当我尝试使用 ffmpeg 复制转换时 它总是会出现如下错误 avi 0x10084fa
  • 如何使用ijkplayer库

    我要使用 ijkplayergithub链接 https github com bbcallen ijkplayer 我下载了这个 然后通过 文件 gt 导入 gt 常规 gt 现有项目到工作区 将其导入到 eclipse 中 之后我有三个
  • 合并来自 ffmpeg 的两个视频

    我想使用 ffmpeg 将两个 mp4 视频组合成一个 mp4 视频 到目前为止我尝试过的是 ffmpeg i input1 mp4 i input2 mp4 output mp4 但是 每次我获取带有第一个输入的视频编解码器的视频而不是另
  • 使用 ffmpeg 将视频与其自身连接,但相反

    我能够逆转 ffmpeg i input mp4 vf reverse output reversed mp4 我可以连接 ffmpeg i input mp4 i input mp4 filter complex 0 0 0 1 1 0
  • Android 上的 GStreamer

    谁能给我一些关于让 GStreamer 在 Android 上工作的提示 我以前从未使用过它 我想将它与 FFmpeg 一起使用 我已经编译了 FFmpeg 并且在 Android 上运行良好 我只是想使用 GStreamer 来帮助完成一
  • 如何为Python程序创建自定义GUI?

    我想为具有自定义设计的 python 程序创建一个 GUI 我在 Photoshop 中有一个模型 我正在寻找一个支持主题的库或任何其他可以完成这项工作的库 我的 GUI 设计包含渐变 边框 边框半径和带有自定义最小化和关闭按钮的自定义标题
  • Google Cloud Platform:将上传的 MP4 文件转换为 HLS 文件

    我正在构建一个平台 允许用户将一些视频文件 20 40 秒 从手机上传到服务器 所有这些上传目前都运行良好 文件通过nodejs云功能存储在谷歌存储桶中 现在我想创建一个 gcp 转码器作业 它将上传的 mp4 视频文件转换为 hls 视频
  • 使用 ffmpeg 提取帧的最快方法?

    您好 我需要使用 ffmpeg 从视频中提取帧 有没有比这更快的方法 ffmpeg i file mpg r 1 1 filename 03d jpg 如果 JPEG 编码步骤对性能要求太高 您可以始终将未压缩的帧存储为 BMP 图像 ff
  • 重新采样 H264 视频以降低帧速率,同时保持高图像质量

    以下是感兴趣的视频的 mplayer 输出 br carina tmp mplayer foo mov mplayer Symbol ff codec bmp tags has different size in shared object
  • 无法在 Windows 7 机器中使用 OpenCV 2.4.3、Python 2.7 打开“.mp4”视频文件

    我目前正在进行一个涉及读取 mp4 视频文件的项目 我遇到的问题是它在Windows 7机器上使用Python 2 7 32位 OpenCV 2 4 3 cv2 pyd 代码片段如下 try video cv2 VideoCapture v
  • Python 用静态图像将 mp3 转换为 mp4

    我有x文件包含一个列表mp3我想转换的文件mp3文件至mp4文件带有static png photo 似乎这里唯一的方法是使用ffmpeg但我不知道如何实现它 我编写了脚本来接受输入mp3文件夹和一个 png photo 然后它将创建新文件
  • 适用于 iPhone 和 HTTP 直播的实时视频聊天

    所以一般来说 我想为 iPhone 制作一个具有视频聊天功能的应用程序 但经过多次搜索 我仍然找不到任何成功的结果 是否有任何公共或私有 API 可用于在 iPhone 上执行此操作 如果您的答案是 是 请帮助我 基本上 我想要的是读取连接
  • 在 MacOS 终端上运行 ffmpeg [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 我对 MacOS 相当陌生 我发现使用终端来获取信息并不容易ffmpeg和我在 Window 上一样正常运行 我有 ffmpeg 二进制文件ffmpe
  • 同时从多个流中捕获、最佳方法以及如何减少 CPU 使用率

    我目前正在编写一个应用程序 该应用程序将捕获大量 RTSP 流 在我的例子中为 12 个 并将其显示在 QT 小部件上 当我超过大约 6 7 个流时 问题就会出现 CPU 使用率激增并且出现明显的卡顿 我认为它不是 QT 绘制函数的原因是因

随机推荐

  • 在 C# 字符串中转义双引号

    我试图逃避 and 在我的字符串中是这样的 text Replace Replace 但结果为text arash moeen 结果是 arash moeen 我怎样才能解决这个问题 只需使用 对于逐字字符串 text Replace th
  • 修补 nant 0.91 以使用 mono 4.0

    The Nant http nant sourceforge net 不支持单声道4 但幸运的是有 我下载了补丁 我也下载了source http nant sourceforge net nightly latest 我解压源代码并将补丁
  • 加载 FXML 时将参数传递给控制器​​[重复]

    这个问题在这里已经有答案了 我有一个登录屏幕 我想将登录 ID 从 LoginController 传递到 MainController 这样我就可以访问一些功能来更改密码等 我像这样加载控制器 FXMLLoader fxmlLoader
  • ValueError:不支持的格式字符'

    我从这里得到了以下大部分代码 使用python脚本生成pdf latex https stackoverflow com questions 8085520 generating pdf latex with python script u
  • 基于 Git 的内容管理? [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我正在寻找一个 Ruby CMS 或插件 可以提供和编辑位于 Git 存储库中的内容 我厌倦了将我的内容放在数据库中 用户 设置 评论 都
  • 致命错误:找不到类“PHPExcel_Shared_String”

    我已将 PHPExcel 用于我的 codeigniter 应用程序 它在本地主机中运行良好 但是当我将其托管到服务器时 出现以下错误 致命错误 在 xx xx xx 中找不到类 PHPExcel Shared String Third p
  • 为什么我的规则不能用简单的代数方程求解 X?

    我是 Prolog 新手 所以请保持温柔 这是我的规则 solve X A B A is 7 X 2 B is 3 X 4 显然 这里的正确答案是6 5 如果我把它交给 Prolog 它会证实 solve 6 5 yes 然而 如果我要求
  • Python解析日期字符串为date

    我正在尝试在 Python 中解析日期时间字符串 输入值的形式为 February 19 1989 到目前为止我一直在努力 datetime datetime strptime February 19 1989 B d y 但我总是出错 解
  • 可以在不损失重要性的情况下转换为二进制并返回十进制的最高有效十进制数字精度是 6 还是 7.225?

    我遇到过两种不同的浮点数精度公式 N 1 log10 2 6 decimal digits Single precision and N log10 2 7 225 decimal digits Single precision Where
  • Netbeans:编译时将文本文件移动到 dist 文件夹中

    我有一个文本文件 假设textfile txt 存储在项目文件夹中网豆 7 3 e g project folder textfile txt src package package subpackage MyClass java 当我编译
  • 在构造函数中初始化静态最终字段

    public class A private static final int x public A x 5 final意味着变量只能分配一次 在构造函数中 static意味着它是一个类实例 我不明白为什么这会被禁止 这些关键词在哪里互相干
  • 用笑话模拟第 3 方库构造函数

    我正在用玩笑编写单元测试 并且必须测试一个从第三方库调用构造函数的函数 测试的目标是检查调用是否使用了良好的参数 第 3 方库是 Popper js 我做了一个jest spyOn Popper prototype constructor
  • 设计管理的会话不会传播到子域

    我正在使用 Devise 来管理 Rails 3 1 应用程序中的身份验证 它在我的生产服务器中运行得很好 但我刚刚设置了一个新的测试服务器 如果我登录主站点 访问子域无法识别会话 它要求我重新登录 我不记得在哪里可以解决此信息的问题 看起
  • 如何在 Azure 广告 B2C 上使用自定义角色?

    我的 API 需要三种类型的用户 我想使用自定义角色定义来管理它 是否可以在 Azure B2c 上创建角色 然后通过 Microsoft Graph API 将这些角色分配给用户 我正在朝着同一个目标努力 所以这是我到目前为止发现的 将自
  • 如何在C中初始化char **?

    我对 C 还很陌生 我应该做一个简单的单词搜索谜题 所以对于 字典 我做了 char dictionary DOG ELEPHANT CAT ETC 但是当我尝试编译时 我收到一条警告 提示字典中的每个单词 标量初始值设定项中存在多余元素
  • MVC 视图的命名空间问题 - Razor 引擎

    我将 System Web DataVisualization 的引用添加到我的 MVC 项目中 现在 当我尝试将命名空间添加到 web config 时 出现错误 CS0234 命名空间 System Web UI 中不存在类型或命名空间
  • Intel芯片上的半精度浮点运算

    Intel芯片上可以进行半精度浮点运算吗 我知道如何加载 存储 转换半精度浮点数 1 但我不知道如何在不转换为单精度浮点数的情况下对它们进行加 乘 1 https software intel com en us articles perf
  • Flutter doctor - Windows 版本(无法确认安装的 Windows 版本是否为 10 或更高版本)

    我刚刚在主频道上将 Flutter 表单 3 5 0 12 0 pre 168 更新为 3 6 0 1 0 pre 35 我在主通道上 因为在稳定通道上我在键盘输入方面遇到了麻烦 但这不应该与这个 问题 有任何关系 实际上这不是一个真正的问
  • 操作完成后如何重置 EditText?

    我想在按下按钮后将我的 EditText 重置回空的 空间 或 提示 该按钮将使用 EditText 字段的输入完成活动 我与 Android 的冒险就这样开始了 干杯 谢谢 SEND SMS btnSendSMS Button findV
  • 将 ffmpeg 与 Python 2.7 结合使用

    我一直尝试在 Python 2 7 中安装 pyffmpeg 但没有成功 我找到了一个 Python 2 6 的包 但我无法让它工作 所以 我一直在考虑2 7 我在这个网站上看过其他人之前的帖子 但他们没有帮助 有人对此有经验吗 最终 我想