Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • python : subprocess call ffmpeg (command line)

    21 septembre 2014, par user3295674

    I have been incorporating subprocess calls in my program. I have had no issues with subprocess calls for other commands, but I am having trouble getting the command line input

    ffmpeg -r 10 -i frame%03d.png -r ntsc movie.mpg
    

    To work inside a subprocess.call()

    I tried the following with no success:

    subprocess.call('ffmpeg -r 10 -i %s frame%03.d.png - r ntsc movie.mpg')
    

    Any thoughts? Do I separate out different commands, do I specify string, integer etc. with %s, %d?

  • FFmpeg : Get volume of frame or short timespan

    21 septembre 2014, par Qaz

    I want to make a program that automatically deletes frames from an mp4 when the volume for those frames is below a given threshold. How can I get the volume of each frame? Or, alternatively, the volume for time t in the video? Or for timespan dt? (I'm not committed to FFmpeg yet, or even to the mp4 format, so feel free to suggest alternatives.)

  • Executing ffmpeg command using Popen

    21 septembre 2014, par dragonator

    I have a strange problem trying to execute ffmpeg command using Popen. I have the following piece of code, which I use for executing an external commands in Python:

    from subprocess import Popen, PIPE
    from datetime import datetime
    
    
    class Executor(object):
    
        @classmethod
        def execute(cls, command):
            """
            Executing a given command and
            writing into a log file in cases where errors arise.
            """
            p = Popen(command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
            output, err = p.communicate()
            if p.returncode:
                with open("failed_commands.log", 'a') as log:
                    now = datetime.now()
                    log.write('{}/{}/{} , {}:{}:{}\n\n'.format(now.day, now.month,
                                                               now.year, now.hour,
                                                               now.minute,
                                                               now.second))
    
                    log.write("COMMAND:\n{}\n\n".format(" ".join(command)))
                    log.write("OUTPUT:\n{}\n\n".format(output.decode("utf-8")))
                    log.write("ERRORS:\n{}\n".format(err.decode("utf-8")))
                    log.write('-'*40)
                    log.write('\n')
    
                return ''
    
            if not output:
                output += ' '
    
            return output
    

    I've tested it with others commands, but when I try to execute ffmpeg command - it fails. I'm trying to convert some audio format to mp3 format. Here is an example of my command:

    ffmpeg -i "/path/old_song.m4a" "/path/new_song.mp3"
    

    ...simple as that.When I run it in terminal it works fine, but when I try to execute it using the above function it fails. Here is the exact error:

    ----------------------------------------
    21/9/2014 , 19:48:50
    
    COMMAND:
    ffmpeg -i "/path/old_song.m4a" "/path/new_song.mp3"
    
    OUTPUT:
    
    
    ERRORS:
    ffmpeg version 2.2.3 Copyright (c) 2000-2014 the FFmpeg developers
      built on Jun  9 2014 08:01:43 with gcc 4.9.0 (GCC) 20140521 (prerelease)
      configuration: --prefix=/usr --disable-debug --disable-static --enable-avisynth --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
      libavutil      52. 66.100 / 52. 66.100
      libavcodec     55. 52.102 / 55. 52.102
      libavformat    55. 33.100 / 55. 33.100
      libavdevice    55. 10.100 / 55. 10.100
      libavfilter     4.  2.100 /  4.  2.100
      libavresample   1.  2.  0 /  1.  2.  0
      libswscale      2.  5.102 /  2.  5.102
      libswresample   0. 18.100 /  0. 18.100
      libpostproc    52.  3.100 / 52.  3.100
    "/path/old_song.m4a": No such file or directory
    Conversion failed!
    
    ----------------------------------------
    

    ...and as you can think of - the file exists.

    I think there is something in passing the command to Popen.communicate but I don't know exactly.

    Kind regards,

    Teodor D. PS: I'm passing the command to Executor.execute as Python list.

    PSS: Calling the Executor.execute :

    def process_conversion(self):
        for song in self.files_to_convert:
            current_format = song.rsplit('.', 1)[-1]
    
            old_file = '"{}{}{}"'.format(self.target_dir, os.sep, song)
            new_file = '"{}{}{}"'.format(self.target_dir, os.sep,
                                         song.replace(current_format, 'mp3'))
    
            command = ["ffmpeg", "-i", old_file, new_file]
            Executor.execute(command)
    
  • ffmpeg install php 5.6.11 xampp window 7 32bit [on hold]

    21 septembre 2014, par yogesh kumar

    I am install ffmpeg but it is provide all detail fulfill below description but not install these error come when we start xampp server how can resolve it ![enter image description here][1] but it is provide error

    some time below error is comming

    Please give me you suggestion/answer

  • Using ffmpeg in Java

    21 septembre 2014, par Riccardo Bestetti

    I'm writing a Java program. I'm receiving a MPEG video stream via TCP and I have to decode it and re-encode it in a different format.

    I have found JJMPEG, which are ffmpeg wrappers for Java, but they don't get an update since 2 years ago. So I thought to implement my conversion by spawning a ffmpeg process from Java and piping the stream into it, and getting the data back from another pipe.

    Would that be a optimal solution? I need feedback from experienced people on both Java and ffmpeg programming.