Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Use ffmpeg to Convert Video to Gif android studio

    26 septembre 2019, par Donnie Ibiyemi

    I am currently making a simple Androidapp that converts a video from the SD card into a gif.

    I learnt ffmpeg is the most efficient method to handle the conversion. But I have no idea how to add ffmeg to my android studio project.

  • filter_complex cannot be used together for the same stream [on hold]

    26 septembre 2019, par Dandi Kantesh

    my code

    ffmpeg -y -i  -filter_complex \
    "[0:v]zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0015))':d=125,fade=t=out:st=4:d=1[v0]; \
     [1:v]zoompan=z='if(lte(zoom,1.0),1.5,max(1.001,zoom-0.0015))':d=125,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v1]; \
     [v0][v1]concat=n=2:v=1:a=0,format=yuv420p[v]" -map [v] image_video.mp4
    

    Error:

    An error occurred: ffmpeg exited with code 1: Filtergraph 'scale=w=720:h=trunc(ow/a/2)*2' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
    -vf/-af/-filter and -filter_complex cannot be used together for the same stream
    
  • ffmpeg sidedata or metadata per frame

    26 septembre 2019, par Dan Gordon

    I'm trying to add either some side data or metadata per frame using the FFMpeg encoding example

    Here's what I have tried so far:

    /* encode 1 second of video */
    for (i = 0; i < 25; i++) {
        fflush(stdout);
        /* make sure the frame data is writable */
        ret = av_frame_make_writable(frame);
        if (ret < 0)
            exit(1);
        /* prepare a dummy image */
        /* Y */
        for (y = 0; y < c->height; y++) {
            for (x = 0; x < c->width; x++) {
                frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
            }
        }
        /* Cb and Cr */
        for (y = 0; y < c->height/2; y++) {
            for (x = 0; x < c->width/2; x++) {
                frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
                frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
            }
        }
        frame->pts = I;
    
        AVFrameSideData *angle = av_frame_new_side_data (frame, AV_FRAME_DATA_GOP_TIMECODE, sizeof(int32_t));
        if(!angle)
            return AVERROR(ENOMEM);
        unint8_t a = i; 
        angle->data = &a;
    
        frame->side_data = angle
        /* encode the image */
        encode(c, frame, pkt, f);
    }
    

    I have also tried using and setting it equal to a AVDictionary

    AVDictionary *d = NULL;
    av_dict_set(&d, "foo", "bar", 0);
    frame->metadata = d;
    

    But nothing is getting added to the encode.

    How do I add data to each frame individually?

  • FFMPEG How to resize image to 1280 x 720 but with aspect ratio - if ratio not exact how to add black background [on hold]

    26 septembre 2019, par Aster

    FFMPEG How to resize image to 1280 x 720 but with aspect ratio. If ratio not exact how to add black background?

    windows 10
    
    ffmpeg -y -i c:/img/image1.jpg -vf scale=1280 x 720 c:/img/image2.jpg
    
  • Bulk identifying images with FFMPEG that contain a graphic

    26 septembre 2019, par edwardv

    I need to be able to bulk sort through images that contain a graphic and remove these images from the folder. The graphic is a ruler-like image for scale.

    I'm a novice with FFMPEG, but have already written a batch script that resizes images. The logic seems pretty understandable, however my issue is that I don't know what and where to research for a solution to my problem. From what I read, imagemagik might also be a great tool, but I feel more comfortable with FFMPEG.

    I expect the script to look through all image files in a folder and find those the contain the ruler graphic and remove the said images with the rule graphic from the folder. The images are product shots on white backgrounds and the rule graphic is not overlaying anything or acting like a watermark.

    Ideally, if possible, a way to crop out the graphics would be an amazing next step.