Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG Video Multiplexer

    4 décembre 2015, par Nader

    I am a DirectShow developer, I used to build multiplexers that take 2 video inputs and generate one output, I would then use a video encoder mux to feed it the output + anothrr audio stream to generate the final video output. The multiplexer (DirectShow framework) allows me to process the input video from two sources (for example, adding effects using the two frames). Does anyone know how this can be done using FFMPEG, or at least point me to the right resources? Thanks

  • ffmpeg resize maintain aspect - filter not found

    4 décembre 2015, par paul

    I am trying to create image thumbnails that maintain the aspect of the orginal but crop it if the dimensions are too far out. found a likely code snippet here

    ffmpeg -i Einstein_500_459.jpg -vf scale="'if(gt(a,320/240),320,-1)':'if(gt(a,320/240),-1,240)'" Einstein_320x240_fit.png
    

    but cannot get ffmpeg to execute it. as is it generates error in terminal:

    ffmpeg -i Einstein_500_459.jpg -vf scale="'if(gt(a,320/240),320,-1)':'if(gt(a,320/240),-1,240)'" Einstein_320x240_fit.png
    ffmpeg version 0.10.12-7:0.10.12-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
      built on Apr 26 2014 09:49:36 with gcc 4.6.3
      configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
      libavutil      51. 35.100 / 51. 35.100
      libavcodec     53. 61.100 / 53. 61.100
      libavformat    53. 32.100 / 53. 32.100
      libavdevice    53.  4.100 / 53.  4.100
      libavfilter     2. 61.100 /  2. 61.100
      libswscale      2.  1.100 /  2.  1.100
      libswresample   0.  6.100 /  0.  6.100
      libpostproc    52.  0.100 / 52.  0.100
    Input #0, image2, from 'Einstein_500_459.jpg':
      Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: mjpeg, yuvj444p, 500x459 [SAR 300:300 DAR 500:459], 25 tbr, 25 tbn, 25 tbc
    Incompatible pixel format 'yuvj444p' for codec 'png', auto-selecting format 'rgb24'
    [buffer @ 0x236d720] w:500 h:459 pixfmt:yuvj444p tb:1/1000000 sar:300/300 sws_param:
    [scale @ 0x235d5e0] [Eval @ 0x7fffcb68f270] Missing ')' or too many args in 'if(gt(a,320/240),320,-1)'
    [scale @ 0x235d5e0] [Eval @ 0x7fffcb68f270] Missing ')' or too many args in 'if(gt(a,320/240),-1,240)'
    Error when evaluating the expression 'if(gt(a,320/240),-1,240)'.
    Maybe the expression for out_w:'if(gt(a,320/240),320,-1)' or for out_h:'if(gt(a,320/240),-1,240)' is self-referencing.
    Error opening filters!
    

    after escaping single quotes

    ffmpeg -i Einstein_500_459.jpg -vf scale="\'if(gt(a,320/240),320,-1)\':\'if(gt(a,320/240),-1,240)\'" Einstein_320x240_fit.png
    

    it generates error

    ffmpeg -i Einstein_500_459.jpg -vf scale="\'if(gt(a,320/240),320,-1)\':\'if(gt(a,320/240),-1,240)\'" Einstein_320x240_fit.png
    ffmpeg version 0.10.12-7:0.10.12-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
      built on Apr 26 2014 09:49:36 with gcc 4.6.3
      configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
      libavutil      51. 35.100 / 51. 35.100
      libavcodec     53. 61.100 / 53. 61.100
      libavformat    53. 32.100 / 53. 32.100
      libavdevice    53.  4.100 / 53.  4.100
      libavfilter     2. 61.100 /  2. 61.100
      libswscale      2.  1.100 /  2.  1.100
      libswresample   0.  6.100 /  0.  6.100
      libpostproc    52.  0.100 / 52.  0.100
    Input #0, image2, from 'Einstein_500_459.jpg':
      Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: mjpeg, yuvj444p, 500x459 [SAR 300:300 DAR 500:459], 25 tbr, 25 tbn, 25 tbc
    Incompatible pixel format 'yuvj444p' for codec 'png', auto-selecting format 'rgb24'
    [buffer @ 0x1897720] w:500 h:459 pixfmt:yuvj444p tb:1/1000000 sar:300/300 sws_param:
    No such filter: '320/240)'
    Error opening filters!
    

    is this just a syntax problem? or is my ffmpeg missing something? or what? this is ubuntu 12.04 with what i believe is a full install of ffmpeg, not the libav default thing. any help is appreciated.

  • encode audio ffmpeg c++ with different number of samples between input and output

    4 décembre 2015, par Victor Canezin de Oliveira

    I am trying to make an audio encoder to encode a live stream. I get my audio stream from a webrtc source. The properties for the source audio buffer is(AND I CANNOT CHANGE IT):

    number of samples: 480 
    sample size: 2 bytes 
    sample rate: 44100Hz 
    number of channels: 1
    

    I am using MP2 codec to encode the audio. It expects an audio number of samples of 1152(CAN'T CHANGE THAT EITHER), which is different from the source(480)

    I generate the audio frame using:

    frame->nb_samples = 480;
    avcodec_fill_audio_frame(frame, nb_channels(=1), sample_fmt(=AVCodecContext sample_fmt), temp_audio_buffer(=source), 480, 0);
    

    And I am getting a "chopped" sound. From what I know, It is because of the difference between number of samples in each frame.

    Is there a way to fill the entire frame(1152 samples) somehow? Will I be able to encode this live stream?

    thanks

  • ffmpeg PNG to mp4 - Black screen

    3 décembre 2015, par ilciavo

    I can create a mpg video using this line

    ffmpeg -f image2 -i 100%03d0.png movie.mpg
    

    But If I try creating an mp4 video I get a video with a black screen.

    ffmpeg -f image2 -i 100%03d0.png movie.mp4
    

    My directory with figures looks like: 1000010.png,1000020.png,...1001260.png

  • Convert audio file using another audio file as template in ffmpeg

    3 décembre 2015, par Iulian Onofrei

    I have some .mp3 audio files, with different "configuration" like sample rate, bit rate, etc.

    For my app, one of them is working and the rest, not.

    How can I convert the rest of them using the working file's "configuration"?

    Metadata of two sample files:

    ~/Downloads ❯ ffmpeg -i working.mp3 -i not_working.mp3
    ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
      built with Apple LLVM version 7.0.0 (clang-700.1.76)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    [mp3 @ 0x7fd2d380da00] Skipping 0 bytes of junk at 33.
    [mp3 @ 0x7fd2d380da00] Estimating duration from bitrate, this may be inaccurate
    Input #0, mp3, from 'working.mp3':
      Metadata:
        encoder         : Lavf52.64.2
      Duration: 00:00:00.65, start: 0.000000, bitrate: 64 kb/s
        Stream #0:0: Audio: mp3, 22050 Hz, mono, s16p, 64 kb/s
    [mp3 @ 0x7fd2d4008800] Skipping 0 bytes of junk at 417.
    Input #1, mp3, from 'not_working.mp3':
      Duration: 00:00:01.83, start: 0.025057, bitrate: 46 kb/s
        Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 46 kb/s
        Metadata:
          encoder         : LAME3.99r