Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (62)

Sur d’autres sites (8692)

  • Running a 2-pass video conversion using Python's subprocess module and ffmpeg

    22 novembre 2012, par ensnare

    I'm trying to convert a bunch of videos to play on my iPad. I'm using the subprocess module, which from what I understand launches a binary in a separate process from my script. I'm not sure how to handle 2-pass encoding which requires that the first process terminate before the second begin.

    Here is my code :

    def convert(filename):
     extension = filename[-3:]

     destination_filename_720 = filename[-4:] + '-a720p' + '.mp4'
     destination_filename_1080 = filename[-4:] + '-a1080p' + '.mp4'

     p = subprocess.Popen(['ffmpeg','-i', str(filename) ,
                           '-acodec' , 'aac' ,
                           '-ab' , '160k' ,
                           '-ac' , '2' ,
                           '-vcodec' , 'libx264' ,
                           '-strict' , '-2' ,
                           '-vpre' , 'ipod640' ,
                           '-threads' , '8' ,
                           '-s' , '1280x720' ,
                           '-b:v' , '2000k' ,
                           '-pass' , '1' ,
                           '-y' ,
                           destination_filename_720])

     p = subprocess.Popen(['ffmpeg','-i', str(filename) ,
                           '-acodec' , 'aac' ,
                           '-ab' , '160k' ,
                           '-ac' , '2' ,
                           '-vcodec' , 'libx264' ,
                           '-strict' , '-2' ,
                           '-vpre' , 'ipod640' ,
                           '-threads' , '8' ,
                           '-s' , '1280x720' ,
                           '-b:v' , '2000k' ,
                           '-pass' , '2' ,
                           '-y' ,
                           destination_filename_720])

    As soon as the convert() function is called, both processes are spawned immediately.

    The second process fails because the first process hasn't yet finished.

    How can I fix this ? Or, is there a better way ?

  • Updated the AMD module requirements.

    12 juin 2013, par blueimp
    Updated the AMD module requirements.
  • Refactored Angular module.

    13 juin 2013, par blueimp
    Refactored Angular module.
    

    Renamed fileupload directive to fileUpload (file-upload in templates)
    for consistency with the service and controllers.
    Preview and Progress directives now use "file-upload-" as prefix as a
    sort of namespace.
    The formatFileSizeFilter now accepts suffix and prefix for the units.
    This allows better localizing for languages which put the unit label
    first.