Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • how to pass the argument for latest file pick

    11 mai 2018, par vikash garg
    cd C:\FFAStrans0.9.0\Processors\ffmpeg\x64
    
    
    for %%a  in ("C:\FFAStrans0.9.0\encode\out\done\*.*")  do ffmpeg -i "%%a" -i  C:\FFAStrans0.9.0\IT.png -filter_complex "overlay=520:20"  C:\FFAStrans0.9.0\encode\out\%%~na.mp4
    
  • Create thumbnail image from video in server in php

    11 mai 2018, par swamy

    In my website I have a option to upload video file by the user. In that I want to create a thumbnail image of that video. I have tried in local system with some coding it is working fine. I tried same coding in to service it is not working. I checked for ffmpeg enabled in server, it was disabled. Is their any other option to creating thumbnail in server with out enabling the ffmpeg? Please help me to find the solution.

  • python ffmpeg moov atom not found Invalid data when processing input

    11 mai 2018, par Isocrates

    I have a progress that records the screen, and audio from a microphone, and then combines the video and audio recording (.mp4 and .wav) into one mkv file.

    I am using python 3.6 and ffmpeg to achieve this aim. For short videos (<20 sec.) it works, but for longer recordings it presents the following error message:

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x55abb3a52540] moov atom not found
    tmp/tmp_0.mp4: Invalid data found when processing input
    

    Full output:

    ffmpeg version 3.3.7 Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 7 (GCC)
    configuration: --prefix=/usr --bindir=/usr/bin -- 
    datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg -- 
    incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man -- 
    arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp, 
    -D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp- 
    buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat- 
    hardened-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables' --extra- 
    ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' -- 
    extra-cflags='-I/usr/include/nvenc ' --enable-libopencore-amrnb -- 
    enable- 
    libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib 
    --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt -- 
    enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable- 
    libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi -- 
    enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable- 
    opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable- 
    libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex -- 
    enable-libtheora --enable-libvorbis --enable-libv4l2 --enable- libvidstab - 
    -enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid -- 
    enable-avfilter --enable-avresample --enable-postproc --enable-pthreads -- 
    disable-static --enable-shared --enable-gpl --disable-debug --disable- 
    stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
      libavutil      55. 58.100 / 55. 58.100
      libavcodec     57. 89.100 / 57. 89.100
      libavformat    57. 71.100 / 57. 71.100
      libavdevice    57.  6.100 / 57.  6.100
      libavfilter     6. 82.100 /  6. 82.100
      libavresample   3.  5.  0 /  3.  5.  0
      libswscale      4.  6.100 /  4.  6.100
      libswresample   2.  7.100 /  2.  7.100
      libpostproc    54.  5.100 / 54.  5.100
    [wav @ 0x55abb3a0b880] Ignoring maximum wav data size, file may be invalid
    [wav @ 0x55abb3a0b880] Estimating duration from bitrate, this may be 
    inaccurate
    Guessed Channel Layout for Input Stream #0.0 : stereo
    Input #0, wav, from 'tmp/tmp_0.wav':
      Metadata:
        encoder         : Lavf57.71.100
      Duration: 00:00:21.97, bitrate: 768 kb/s
    Stream #0:0: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 48000 Hz, 
    stereo, s16, 768 kb/s
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x55abb3a52540] moov atom not found
    tmp/tmp_0.mp4: Invalid data found when processing input
    

    The python file (ffmpeg.py) is as follows. The class, AV_COMPILE, is not yet complete, held up by the aforementioned error, and therefore still uses the initial test files as defaults. But otherwise it ought to work:

    import os, time, glob
    
    TMP_DIR = "tmp"
    DISPLAY = os.environ['DISPLAY']
    EXT = {
        'Video':'mp4',
        'Audio':'wav',
        'AV':'mkv',
    }
    
    class ffmpegVideo:
    
        FFMPEG_BIN = "ffmpeg"
        AUDIO = False
    
        def __init__(self, fps = 30, audio = True):
        global TMP_DIR, DISPLAY, EXT
    
        self.fps = fps
    
        if audio:
            self.AUDIO = True
    
        self.video_filename = self.unique_filename()
    
        self.command = [ self.FFMPEG_BIN,
            '-video_size', '1920x1080',
            '-framerate', str(fps),
            '-f', 'x11grab',
            '-i', DISPLAY,
            '-vcodec', 'libx264',
            '-qp', '0',
            '-preset', 'ultrafast',
            '-y', TMP_DIR + '/' + self.video_filename
        ]
    
    def start(self):
        import threading as th
    
        thread = th.Thread(target=self.record)
        thread.start()
    
    def record(self):
        import subprocess as sp
    
        self.pipe = sp.Popen(self.command, stderr=sp.PIPE)
    
        if self.AUDIO:
            ffmpegAudio().start()
    
    def stop(self):
        self.pipe.terminate()
    
    def unique_filename(self):
        global TMP_DIR, EXT
    
        i = 0
    
        while os.path.exists((TMP_DIR + '/' + 'tmp_%s.%s') % (i, EXT['Video'])):
            i += 1
    
        return ('tmp_%s.%s') % (i, EXT['Video'])
    
    class ffmpegAudio:
    
        FFMPEG_BIN = "ffmpeg"
    
        def __init__(self):
    
            self.audio_filename = self.unique_filename()
    
            self.command = [ self.FFMPEG_BIN,
                '-f', 'pulse',
                '-ac', '2',
                '-ar', '48000',
                '-i', 'default',
               '-acodec', 'pcm_mulaw',
               '-y', TMP_DIR + '/' + self.audio_filename
            ]
    
        def start(self):
            import threading as th
    
            au_thread = th.Thread(target=self.record)
            au_thread.start()
    
        def record(self):
             import subprocess as sp
    
            self.pipe = sp.Popen(self.command, stderr=sp.PIPE)
    
        def stop(self):
            self.pipe.terminate()
    
        def unique_filename(self):
            global TMP_DIR, EXT
    
            i = 0
    
            while os.path.exists((TMP_DIR + '/' + 'tmp_%s.%s') % (i, EXT['Audio'])):
            i += 1
    
            return ('tmp_%s.%s') % (i, EXT['Audio'])
    
    class AV_COMPILE:
    
        def __init__(self, au_in = TMP_DIR + '/' + 'out1.wav', vd_in = 
    TMP_DIR + '/' + 'test4.mp4', out = TMP_DIR + '/' + 'av.mkv'):
            import subprocess as sp
    
            au_in = min(glob.iglob(TMP_DIR + '/*.wav'), key=os.path.getctime)
            vd_in = min(glob.iglob(TMP_DIR + '/*.mp4'), key=os.path.getctime)
    
            self.command = ('ffmpeg -i %s  -r 30 -i %s -shortest -c:a aac -c:v copy %s') % (au_in, vd_in, out)
            sp.call(self.command, shell=True)
    

    I would be grateful for any assistance you could provide in understanding why this happens and how to solve the error. Also, I am happy to receive any other tips on how to improve this code, or any other problems anyone might notice.

    EDIT: I now believe that the reason for this error in longer videos, and occasionally shorter, is that the program is proceeding to attempt to compile the av output whether or not it has finished compiling the original video file. I tested a time.sleep(10) function to delay AV_COMPILE, and this seems to work.

    However, as video files get larger, obviously the delay needs to be adjusted. So I should like to know how I can separately check the integrity of the video file and determine that it is safe to proceed to the next step.

  • is there any functional build of ffmpeg to android

    11 mai 2018, par Rafael Lima

    I've searching the last 3 days for a usable API for android access ffmpeg. Since FFMpeg group doesn't release an official lib for android I found several paralel projects trying to build it.

    So it brings me to my nightmare that is called compile.

    i've followed all these tutorials: https://trac.ffmpeg.org/wiki/CompilationGuide/Android

    And others found in different places. but none of them build

    NONE OF THEM IS LESS THAN 3 YEARS OLD

    Sorry for the caps, but it is frustrating... no ffmpeg build projects I found deal with nkd above 14 and google doesn't keep in archive nkds older than that, so even if i agree with get all outdated libraries source i cant reproduce de compiler i cant download the same ndk...

    The only api i manage to download with a functional build of ffmpeg probably was compiled without some codecs, because on my tests i can only handle few types of videos

    ===============================================================

    The question is, does anyone know an actual, stable, project for building ffmpeg to android?

    I'm even willing to pay in order to get a working version of it

  • NODE.JS using audioconcat , configured ffmpeg but still have prob

    11 mai 2018, par Adnan Khan

    Want to concatenate two audio files. i used an npm package known as audioconcat but when i installed and configured the below code i am confronted with the following error

    Error: Error: Cannot find ffmpeg
        at E:\VoiceMan\registercheck\node_modules\fluent-ffmpeg\lib\processor.js:136:22
        at E:\VoiceMan\registercheck\node_modules\fluent-ffmpeg\lib\capabilities.js:123:9
        at E:\VoiceMan\registercheck\node_modules\async\dist\async.js:356:16
        at nextTask (E:\VoiceMan\registercheck\node_modules\async\dist\async.js:5057:29)
        at E:\VoiceMan\registercheck\node_modules\async\dist\async.js:5064:13
        at apply (E:\VoiceMan\registercheck\node_modules\async\dist\async.js:21:25)
        at E:\VoiceMan\registercheck\node_modules\async\dist\async.js:56:12
        at E:\VoiceMan\registercheck\node_modules\async\dist\async.js:840:16
        at E:\VoiceMan\registercheck\node_modules\fluent-ffmpeg\lib\capabilities.js:116:11
        at E:\VoiceMan\registercheck\node_modules\fluent-ffmpeg\lib\utils.js:223:16
    ffmpeg stderr: undefined
    

    Then I put my problem on stackoverflow. A kind developer suggest me to install ffmpeg also. which i successfully installed and set there path variables but now i am having another issue which tells me that no such file are directry found..i placed my audio files in the same folder of this module. here is the error

    working11
    working1123423423423
    ffmpeg process started: ffmpeg -i concat:audio/a(1).m4a|audio/a(2).m4a|audio/a(3).m4a -y -acodec copy all.m4a
    Error: Error: ffmpeg exited with code 1: concat:audio/a(1).m4a|audio/a(2).m4a|audio/a(3).m4a: No such file or directory
    
        at ChildProcess. (C:\Projects\audio\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
        at emitTwo (events.js:126:13)
        at ChildProcess.emit (events.js:214:7)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    ffmpeg stderr: ffmpeg version N-90173-gfa0c9d69d3 Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 7.3.0 (GCC)
      configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libas
    s --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --ena
    ble-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack -
    -enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidst
    ab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda
     --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
      libavutil      56.  7.101 / 56.  7.101
      libavcodec     58. 13.100 / 58. 13.100
      libavformat    58. 10.100 / 58. 10.100
      libavdevice    58.  2.100 / 58.  2.100
      libavfilter     7. 12.100 /  7. 12.100
      libswscale      5.  0.101 /  5.  0.101
      libswresample   3.  0.101 /  3.  0.101
      libpostproc    55.  0.100 / 55.  0.100
    concat:audio/a(1).m4a|audio/a(2).m4a|audio/a(3).m4a: No such file or directory
    

    here is my code :

    var audioconcat = require('audioconcat')
    
    
    var songs = [
      'a(1).mp3',
      'a(2).mp3',
      'a(3).mp3'
    ]
     console.log("working11")
    audioconcat(songs)
    
      .concat('all.mp3') 
      .on('start', function (command) {
        console.log('ffmpeg process started:', command)
      })
      .on('error', function (err, stdout, stderr) {
        console.error('Error:', err)
        console.error('ffmpeg stderr:', stderr)
      })
      .on('end', function (output) {
        console.error('Audio created in:', output)
      })
       console.log("working1123423423423")