Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Android FFmpeg ComplexCommand to remove frames from the back of a video

    17 août 2017, par Tix

    Compiled using

    compile 'com.writingminds:FFmpegAndroid:0.3.2'

    Currently i have only managed to come up with a complexcommand that removes duplicate frames, and only start to capture frames from frame 25 onwards of a video like so:

    String[] complexCommand = {"-y", "-i", yourRealPath, "-an", "-framerate", "60", "-vf", "select='gte(n,25)'", "-vsync", "0", dest.getAbsolutePath()};

    select='gte(n,25)' will return me all frames from frame 25 onwards.

    "-vsync", "0" will remove duplicate frames.

    Now i want to ALSO remove certain number of frames from the back of the video, for e.g. i want to remove the last 20 frames. How do I go about doing that?

  • Does FFMPEG utilize CUDA or any other hardware acceleration yet ?

    17 août 2017, par Jason

    Simple question, but I am having trouble finding the answer.

    We are deciding on a transcoding engine (preferrably open source) and it looks to me that FFMPEG does not utilize hardware acceleration, but I am not sure.

    I believe ffmpeg uses libavcodec, the same library used in countless other products, such as Handbrake. I can't believe they don't support hardware acceleration, therefore, my question.

  • I'm trying to use ffmpeg with qt but I get undefined references errors

    16 août 2017, par Dominik Révai

    I tried to solve this problem myself but I couldn't. I installed FFmpeg with msys 3 step method:

    configure 
    make 
    make install 
    

    and tried to link every library in the .pro. At first, I got errors like an undefined reference to avcodec_register_all(); but after linking all the libraries they stopped and instead of them I got 6 others:

    c:\ffmpeg-3.3.3\libavutil\error.c:120: error: undefined reference to `strerror_r'

    c:\mingw\include\time.h:422: error: undefined reference to `__mingw_sleep'

    c:\mingw\include\stdlib.h:810: error: undefined reference to `__mingw_mkstemp'

    c:\mingw\include\stdlib.h:810: error: undefined reference to `__mingw_mkstemp'

    localcharset.c:-1: error: undefined reference to `_imp__GetACP@0'

    collect2.exe:-1: error: error: ld returned 1 exit status

    this is main.cpp:

    #include 
    
    using namespace std;
    
    #define __STDC_CONSTANT_MACROS
    
    extern "C" {
        #include frame.h>
        #include mem.h>
        #include avcodec.h>
    }
    
    int main(int argc, char *argv[])
    {
        cout << "Enter input file name." << endl;
        string inName, outName;
        cin>>inName;
        cout<<"Enter output file name."<>outName;
        avcodec_register_all();
        return 0;
    }
    

    and my .pro

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG -= app_bundle
    CONFIG -= qt
    
    SOURCES += main.cpp
    
    
    LIBS += -LC:\ffmpeg-3.3.3\ffmpeg\lib
    LIBS += -lpthread
    LIBS += -lavdevice
    LIBS += -lavfilter
    LIBS += -lavformat
    LIBS += -lavcodec
    LIBS += -lz
    LIBS += -lswresample
    LIBS += -lswscale
    LIBS += -lavutil
    LIBS += -lm
    INCLUDEPATH += C:/ffmpeg-3.3.3/ffmpeg/include
    
  • FFmpeg and ytdl in javascript ?

    16 août 2017, par Filip

    is there any ports for ytdl and ffmpeg? ive only seen it in node.js Can i make javascript communicate with the node.js server and make node.js do all the work?

  • Ffmpeg/Fluent-Ffmpeg : Output file #0 does not contain any stream

    16 août 2017, par Code Sherpa

    Use Case

    When a user records an audio file and uploads to firebase storage, run a trigger that crops a clip of that file and saves it to a "preview" directory.

    Problem

    Getting Output file #0 does not contain any stream after static .AAC file is downloaded to temp directory and ffmpeg command is run.

    Environment

    • mac client / firebase storage
    • node v8.1.0
    • ffmpeg v3.2.2
    • fluent-ffmpeg v2.1.2

    Node Code

      var command = new ffmpeg({ source: tempFilePath, timeout: 0 })
          .setFfmpegPath(ffmpegPath)
          .setFfprobePath(ffprobePath)
          .inputOption('-t', '10')
          .inputOption('-ss', '10')
          .outputOption('-acodec', 'copy')
          .on('start', function(commandLine) {
                console.log('Spawned Ffmpeg with command: ', commandLine);
           })
          .on('end', function() {
              console.log('Preview file cropping done successfully');
           })
          .on('error', function(err, stdout, stderr) {
              var build = err;
              if (!stdout === '') { build = build + '\n' + stdout; }
              build = build + '\n' + stderr;
    
              console.log(build);
           }).save(tempFilePath);
    

    Ffmpeg Command

    Spawned Ffmpeg with command: ffmpeg -t 10 -ss 10 -i /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac -y -acodec copy /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac

    Debug Output From Firebase

    Error: ffmpeg exited with code 1: Output #0, adts, to '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Output file #0 does not contain any stream

    ffmpeg version 3.2.2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.1 (Debian 5.4.1-4) 20161202 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x3a00e60] Format aac detected only with low score of 1, misdetection possible! [aac @ 0x3a00e60] Could not find codec parameters for stream 0 (Audio: aac, 0 channels, fltp): unspecified sample rate Consider increasing the value for the 'analyzeduration' and 'probesize' options /tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac: could not seek to position 10.000 Input #0, aac, from '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac':
    Duration: N/A, bitrate: N/A Stream #0:0: Audio: aac, 0 channels, fltp Output #0, adts, to '/tmp/2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Output file #0 does not contain any stream

    Console Output

    | $ ffmpeg -t 10 -ss 10 -i 2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac -y -acodec aac output_file.aac

    ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers built with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x7fac6c800a00] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from '2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Duration: 00:01:07.71, bitrate: 223 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 277 kb/s Output #0, adts, to 'output_file.aac': Metadata: encoder : Lavf57.56.100 Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc57.64.101 aac Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> aac (native)) Press [q] to stop, [?] for help size= 159kB time=00:00:10.00 bitrate= 130.5kbits/s speed=12.7x video:0kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.887004% [aac @ 0x7fac6d004600] Qavg: 383.548

    Origin File Format

    $ ffprobe -show_format 2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac

    ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers
    built with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x7fefbd001400] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from '2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac': Duration: 00:01:07.71, bitrate: 223 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 223 kb/s [FORMAT] filename=2EB100B0-6C1E-4D51-9087-764CA653AFC720170711232034.aac nb_streams=1 nb_programs=0 format_name=aac format_long_name=raw ADTS AAC (Advanced Audio Coding) start_time=N/A duration=67.706333 size=1892392 bit_rate=223599 probe_score=51 [/FORMAT]

    Output File Format

    $ ffprobe -show_format output_file.aac ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers built with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 [aac @ 0x7fa904802a00] Estimating duration from bitrate, this may be inaccurate Input #0, aac, from 'output_file.aac':
    Duration: 00:00:09.45, bitrate: 138 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 138 kb/s [FORMAT] filename=output_file.aac nb_streams=1 nb_programs=0 format_name=aac format_long_name=raw ADTS AAC (Advanced Audio Coding) start_time=N/A duration=9.454635 size=163278 bit_rate=138156 probe_score=51 [/FORMAT]

    Comments & Observations

    • I am able to run the ffmpeg command (provided above) locally and get the results I want.

    • The origin file is AAC. I have verified that it is, indeed, an AAC file and not a different file type masquerading as an AAC.

    • The output file format appears as audio/x-aac in firebase. I would expect it to be the same as the origin file - audio/aac.