Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How capture 5 thumbnail from frames 1,25%,50%,75%,100% of video with ffmpeg

    14 décembre 2017, par Ali Irani

    I want capture five thumbnail from 5 points of a video with same distance from each other like 1,25%,50%,75%,100%

  • is there any maximum ffmpeg running simultaneously ?

    14 décembre 2017, par HQM

    I'm developing a video encoding service using ffmpeg that wrapped by python+django

    My service is running ffmpeg asynchronously by using celery The problem is, the resulted video sometimes freezing in some part of the video but there's no error raised.

    Is there any maximum number that ffmpeg running simultaneously?

  • Trouble when executing the same ffmpeg command for many times

    14 décembre 2017, par Chan

    Description

    when using the same ffmpeg command for a couple of times, some of those will succeed, but, some of those would failed, ffmpeg report Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height or Invalid data found when processing input error.

    Input

    ffprobe

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/2137b8d42dcf4607a625755994133e69':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf56.4.101
      Duration: 00:01:00.02, start: 0.021333, bitrate: N/A
        Chapter #0.0: start 0.000000, end 60.000000
        Metadata:
          title           : 00:00:00.000
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x798 [SAR 1:1 DAR 320:133], 3255 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 192 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
        Stream #0:2(eng): Subtitle: mov_text (text / 0x74786574), 0 kb/s
        Metadata:
          handler_name    : SubtitleHandler
    

    Command

    /usr/local/bin/ffmpeg -i /tmp/2137b8d42dcf4607a625755994133e69 -f mp4 -b:v 3000k -r 24.0 -map_metadata -1 -vf scale=50:50 -y /tmp/foo.mp4
    

    Detail

    when I execute same command above 10 times, error would occur like 3 - 4 times.

  • Combining multiple image files into a video while using filter_complex to apply a watermark

    14 décembre 2017, par Geuis

    I'm trying to combine two ffmpeg operations into a single one.

    Currently I have two sets of ffmpeg commands that first generate a video from existing images, then runs that video through ffmpeg again to apply a watermark.

    I'd like to see if its possible to combine these into a single operation.

    # Create the source video
    ffmpeg -y \
    -framerate 1/1 \
    -i layer-%d.png \
    -r 30 -vcodec libx264 -preset ultrafast -crf 23 -pix_fmt yuv420p \
    output.mp4
    
    # Apply the watermark and render the final output
    ffmpeg -y \
    -i output.mp4 \
    -i logo.png \
    -filter_complex "[1:v][0:v]scale2ref=40:40[a][b];[b][a]overlay=(80):(main_h-200-80)" \
    final.mp4
    
  • How to stop recording dynamically in FFMPEG CLI Wrapper java

    14 décembre 2017, par user2237529

    https://github.com/bramp/ffmpeg-cli-wrapper/issues/13

    public class ScreenCaptureFFMPEG {
    
        public static void record(String outputVideo, String time) throws Exception
        {
            RunProcessFunction func = new RunProcessFunction();
    
            FFmpeg ffmpeg = new FFmpeg("C:\\FFMPEG\\ffmpeg.exe");
            FFmpegBuilder builder = new FFmpegBuilder()
                    .addExtraArgs("-rtbufsize", "1500M")
                    .addExtraArgs("-r", "30")
                    .setFormat("dshow")
                    .setInput("video=\"screen-capture-recorder\"")
                    .addOutput(outputVideo)
                    .setFormat("mp4")
                    .addExtraArgs("-crf", "0")
                    .setVideoCodec("libx264")
                    //.addExtraArgs("-ac", "1")
                    .addExtraArgs("-y")
            //overwrite file name
    
                    // .setAudioCodec("libmp3lame")
                    // .setAudioSampleRate(FFmpeg.AUDIO_SAMPLE_44100)
                    //  .setAudioBitRate(1_000_000)
    
                    //.addExtraArgs("-ar", "44100")
                    .addExtraArgs("-t", time)
    
                    //.setVideoPixelFormat("yuv420p")
                    //.setVideoResolution(426, 240)
                    //.setVideoBitRate(2_000_000)
                    //.setVideoFrameRate(30)
                    //.addExtraArgs("-deinterlace")
                    //.addExtraArgs("-preset", "medium")
                    //.addExtraArgs("-g", "30")
                    .done();
            FFmpegExecutor executor = new FFmpegExecutor(ffmpeg);
    
            executor.createJob(builder).run();
    
    
        }
    
        public static void capture(String name) throws Exception
        {
            BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
            ImageIO.write(image, "png", new File(name));
    
        }
    
        public static void main(String[]args) throws Exception {
    
            capture("start.png");
            //record("TC_test.mp4", "00:00:10");
            capture("end.png");
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    // Insert some method call here.
                    try {
                        record("TC_test.mp4", "00:00:10");
                    }
                    catch(Exception e)
                    {
                        System.out.println("hello");
                    }
                }
            });
            Thread.sleep(5000);
    
            t.interrupt();
    
        }
    }
    

    I am trying to stop the recording by killing the subprocess or if there is any other method its fine too. But I am unable to do that. I know its supported according to the github link. How do I kill a subprocess please?

    PS: THis is the first time i post a question on stackoverflow so If I made any mistakes please excuse me and provide details on how i can improve