Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFmpeg overlay image on video with opacity

    25 août 2015, par HardCore CODER

    I want to overlay an image with opacity... I know how to overlay an image on a video, but I don't understand how to give opacity too. I can easily add a watermark on my video, but this watermark is on opacity 100%:

    ffmpeg -i aa.mov -i image.png -filter_complex 'overlay=10:10' bb.mp4
    

    But how do I make the image file have an opacity of 50%?

    Something like this:

    ffmpeg -i aa.mov -i image.png -filter_complex 'overlay=10:10,
    opacity=0.5' bb.mp4
    
  • How can I read process getInputstream ?

    25 août 2015, par NeverJr

    I use process builder and process ( with the ffmpeg), and I have to redirect the ffmpeg output to the java input. I wrote this short code, but the inputstream is empty anyways...

    public class Ffmpegtest {
    public static void main(String[] args) {
        String[] cmd = {"ffmpeg ","-i ","output2.mp4 ","-f ","mp4 ", "-"};
        InputStream stream;
        try {
            stream = new ProcessBuilder(Arrays.asList(cmd)).start().getInputStream();
            System.out.println(stream.available()); // still 0
            byte[] kilo = new byte[1024];
            int i = stream.read(kilo,0,1024);
            while(i != -1){
                System.out.println("read "+1024);
                i = stream.read(kilo,0,1024);
            }
    
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    }
    
  • FFmpeg libraries : Exactly constant segment duration for HLS

    25 août 2015, par user2677612

    We are using FFmpeg libraries git-ee94362 libavformat v55.2.100. Our purpose is to mux two streams (video and audio) into M3U8 playlist using HLS. In addition, we want the duration of every TS segment file be exactly 3.0 sec (frame rate is 25 fps).

    To reach it, we are trying to set several options and properties, namely: - segment_time
    - keyint_min - scenechange_threshold - gop_size - force_key_frames.

    And our code looks as below:

    AVCodecContext *codec_ctx = NULL;
    AVFormatContext *ofmt_ctx = NULL;
    
    int ret = 0, gopSize = (int)(3.0 * 25);   // 3 sec * 25 fps
    
    // ofmt_ctx and codec_ctx initialization and filling are OK, but: 
    codec_ctx->time_base.num = 1;
    codec_ctx->time_base.den = 25 // fps
    
    // It seems, that the following three lines have no effect without explisit setting of the "hls_time" property
    codec_ctx->keyint_min = gopSize;       // in FFMpeg application, the corresponding option is "-keyint_min 3"
    codec_ctx->scenechange_threshold = 0;  // in FFMpeg application, the corresponding option is "-sc_threshold 0"
    codec_ctx->gop_size = gopSize;         // in FFMpeg application, the corresponding option is "-g 3"
    
    ret = av_opt_set_double(ofmt_ctx, "hls_time", 3.0, AV_OPT_SEARCH_CHILDREN);
    
    // Any of the following lines causes "Option not found" error.
    ret = av_opt_set(codec_ctx->priv_data, "profile", "main", AV_OPT_SEARCH_CHILDREN);
    ret = av_opt_set(codec_ctx->priv_data, "preset", "ultrafast", AV_OPT_SEARCH_CHILDREN);
    ret = av_opt_get(ofmt_ctx, "segment_time",  AV_OPT_SEARCH_CHILDREN, &str);
    ret = av_opt_set((ofmt_ctx, "segment_time", "3.0", AV_OPT_SEARCH_CHILDREN);
    

    Anyway, the TS files durations are different, (~2-3 sec), and not EXACTLY 3.0 sec. Our question: What is the best way to solve the problem?

    Andrey Mochenov.

  • Android : Add multiple sounds to video at specific time with sound overlapping

    25 août 2015, par user3285333

    So I have this movie maker app, which allows the user while the video is playing to click some sound buttons, and then the sound will be added to that specific time of the video.

    The user can click twice really fast, which should allow both sounds to be playing simultaneously.

    This needs to be merged into one .mp4 file in order for the user to save it to the device.

    Anyone know a solution to this?

  • what is recommended to use with Mpeg-dash, VBR or CBR ?

    25 août 2015, par jobin

    I need to trans code some videos to use them with Mpeg-dash, for bitrate, shroud I use variable bitrate (VBR) or constant bitrate (CBR).

    which of them work better with Mpeg-dash?