Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to add overlay image on Video in Android and remove it after certain time interval ?

    19 août 2018, par Alok Gupta

    I have been working on an Android app where I need to display an image (which is basically a Summary of the video) on the video. So, when we play video an Image will be displayed for 5 seconds and then video will start playing.

    I am using FFMPEG for this (I am a very beginner to it). I have identified how to add overlay image on video and below is the code that I am using, but somehow it is not giving me correct results. Please refer to the code that I have currently:

    String[] cmd = new String[]{"-i", finalVideoPath, "-stream_loop", "1", "-t", "15", "-i", summaryImagePath,
                "-filter_complex", "[1:v]format=rgba,fade=in:st=1:d=1:alpha=1,fade=out:st=6:d=1:alpha=1 [ovr]; [0][ovr] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2",
                "-preset", "ultrafast", "-acodec", "copy", "-map", "0:a?", finalOutputVideo};
    

    I am expecting that the command that I wrote above will: 1. Open the video and will pick up the image and apply on it for sometime. 2. The image will fade out after sometime (given in st and d parameters. 3. Image will come centered on the screen.

    The output is exact opposite: What happens is - The video is overlaid on the image, the video gets hidden after a few seconds (whereas it should be opposite). I tried replacing the values of image and video in the command but started getting error.

    Can someone guide me here. I would really be Thankful.

  • Converting DTS to AAC with ffmpeg shifts spoken audio to the right

    18 août 2018, par Giuseppe

    I am using ffmpeg to convert mkv movies to mp4, like so:

    $ ffmpeg -i source.mkv -c:v copy -c:a aac destination.mp4
    

    By doing this, the audio stream gets converted from the original DTS:

    Stream #0:1: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
    

    To AAC:

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 394 kb/s (default)
    

    The resulting file plays just fine, except that the spoken audio (what I am assuming would be sent to the central channel in a 5.1 configuration) sounds clearly shifted to the right, when listening through the MacBook's built-in speakers or my stereo headphones. Note that music and other sound effects appear unaffected, properly balanced. Also note that I have been able to reproduce this behavior with a variety of source files.

    Here's ffmpeg's banner:

    ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
      built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
      libavutil      56. 14.100 / 56. 14.100
      libavcodec     58. 18.100 / 58. 18.100
      libavformat    58. 12.100 / 58. 12.100
      libavdevice    58.  3.100 / 58.  3.100
      libavfilter     7. 16.100 /  7. 16.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  1.100 /  5.  1.100
      libswresample   3.  1.100 /  3.  1.100
      libpostproc    55.  1.100 / 55.  1.100
    
  • which h264 profile supported by dxva2 hardaware decoder

    18 août 2018, par Chintan Patel

    I have code which decode live h264 camera stream and dispay. I have use ffmpeg dxvae decoder.

    Problems : avcodec_send_packet return negative error code.

    What I have Tried :

    1. I have dump stream packet and save in h264 file. then ffmpeg.exe -hwaccel dxva2 -threads 1 -i output.h264 -f null - -benchmark command verify and it throws error Failed setup for format dxva2_vld: hwaccel initialisation returned error.

    2. I have found h264 file has baseline profile. does baseline profile not supported by dxva2 decoder?

    3. I am able to play file with vlc player.

    Also I had decode high profile h264 video using above command and its works fine.

    please help to fix this. thanks in advance.

  • is it possible to send ffmpeg images by using pipe ?

    18 août 2018, par Yanshof

    I want to send images as input to ffmpeg and I want ffmpeg to output video to a stream (webRtc format.)

    I found some information that from my understanding showed this is possible. - I believe that ffmpeg could receive image from a pipe, does anyone know how this can be done ?

  • Getting error when use ffmpeg to covert jpg to mov using DNXHD codec

    18 août 2018, par Chang Zhao

    I am using ffmpeg to covert jpg to mov. I am asked to use DNxHD 115 codec, and framerate is 24, so I wrote the below command:

    ffmpeg -i my.jpg -r 24 -s 1920x1080 -vcodec dnxhd -b:v 115m -y test.mov
    

    but it is throwing error:

    [swscaler @ 0xefae40] deprecated pixel format used, make sure you did set range correctly
    [dnxhd @ 0xf1c580] video parameters incompatible with DNxHD. Valid DNxHD profiles:
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:175Mbps; pixel format:yuv422p10; framerate:24000/1001
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:185Mbps; pixel format:yuv422p10; framerate:25/1
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:115Mbps; pixel format:yuv422p; framerate:24000/1001
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:120Mbps; pixel format:yuv422p; framerate:25/1
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:175Mbps; pixel format:yuv422p; framerate:24000/1001
    [dnxhd @ 0xf1c580] Frame Size:1920x1080p; bitrate:185Mbps; pixel format:yuv422p; framerate:25/1
    Stream mapping:
        Stream #0:0 -> #0:0 (mjpeg(native) -> dnxhd(native))
    Error while openig encoder for output stream #0:0 - maybe incorrect parameter such as bit_rate, rate, width or height
    

    I have tried all the options but no success.