Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Convert video using ffmpeg for watermark creation with multiple text

    19 septembre 2016, par Iura Gaitur

    I want to convert a video using FFMPEG and place a watermark with multiple texts on it. Combining the commands for placing a text and a watermark is :

    ffmpeg -i input_1.mp4 -i watermark_small.png -filter_complex "[0]overlay=10:10; [1]drawtext=enable='between(t,0,12)':fontfile=font.ttf:text='Some text' : fontcolor=black: fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30, drawtext=enable='between(t,14,22)':fontfile=font.ttf:text='Next text' : fontcolor=black: fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30" -codec:v libx264 -preset ultrafast output1.mp4

    Unfortunately this command puts the watermark and the first text but not the next text. I assume the problem is on -filter_complex setting. Unfortunately I don't know how to set it in the right way in order to work. Could someone help me and say what needs to be changed in this command in order to convert it in the right way?

  • which process to use for encoding and editing videos in android

    18 septembre 2016, par Ashish Mathur

    i want to build a video editor like this app Link

    my problem is that should i use ffmpeg or any other similar library to encode the videos to edit and then to decode them or should i use completely different approach to edit the videos. any help will be appreciated

  • Send SDL frame to another process and display it

    18 septembre 2016, par Amit_sh

    I am trying to send a frame to another process in order to display it. I'm using dranger tutorial02.

    I was thinking to serialize the SDL_Overlay struct to bytes after the call to sws_scale, send it to the other process, deserialize it and call SDL_DisplayYUVOverlay to display it.

    Do you think this is my best choice?

    If so, I'm having hard time serializing this struct.. here's the code:

    size_t size_of_Overlay(SDL_Overlay *bmp) {
        /*
         * typedef struct  {
         *
         *  Uint32 format;
         *  int w, h;
         *  int planes;
         *  Uint16 *pitches;
         *  Uint8  **pixels;
         *  Uint32 hw_overlay:1; <- can I ignore it? cant point to a bit-field..
         *  
         *  } SDL_Overlay;
         */ 
         //      w,h,planes      format             pitches                pixels
        return sizeof(int)*3 + sizeof(Uint32) + sizeof(Uint16)*bmp->w + sizeof(Uint8)*bmp->h*3;
    }
    
    void overlay_to_buf(SDL_Overlay* bmp, char* buf) {
    
        if(!bmp || !buf) {
            perror("overlay_to_buf");
            exit(1);
        }
    
        memcpy(buf, &bmp->format, sizeof(Uint32));
        buf += sizeof(Uint32);
    
        memcpy(buf, &bmp->w, sizeof(int));
        buf += sizeof(int);
    
        memcpy(buf, &bmp->h, sizeof(int));
        buf += sizeof(int);
    
        memcpy(buf, &bmp->planes, sizeof(int));
        buf += sizeof(int);
    
        memcpy(buf, bmp->pitches, sizeof(Uint16)*bmp->w);
        buf += sizeof(Uint16)*bmp->w;
    
        memcpy(buf, bmp->pixels[0], sizeof(Uint8)*bmp->h);  
        buf += sizeof(Uint8)*bmp->h;
    
        memcpy(buf, bmp->pixels[1], sizeof(Uint8)*bmp->h);  
        buf += sizeof(Uint8)*bmp->h;
    
        memcpy(buf, bmp->pixels[2], sizeof(Uint8)*bmp->h);  
        buf += sizeof(Uint8)*bmp->h;
    }
    
    
    void buf_to_overlay(SDL_Overlay *bmp, char* buf) {
    
        if(!bmp || !buf) {
            perror("buf_to_overlay");
            exit(1);
        }
    
        memcpy(&bmp->format, buf, sizeof(Uint32));
        buf += sizeof(Uint32);
    
        memcpy(&bmp->w, buf, sizeof(int));
        buf += sizeof(int);
    
        memcpy(&bmp->h, buf, sizeof(int));
        buf += sizeof(int);
    
        memcpy(&bmp->planes, buf, sizeof(int));
        buf += sizeof(int);
    
        bmp->pitches = (Uint16*)malloc(sizeof(Uint16)*bmp->w);
        memcpy(bmp->pitches, buf, sizeof(Uint16)*bmp->w);
        buf += sizeof(Uint16)*bmp->w;
    
        bmp->pixels[0] = (Uint8*)malloc(sizeof(Uint8)*bmp->h);
        memcpy(bmp->pixels[0], buf, sizeof(Uint8)*bmp->h);
        buf += sizeof(Uint8)*bmp->h;
    
        bmp->pixels[1] = (Uint8*)malloc(sizeof(Uint8)*bmp->h);
        memcpy(bmp->pixels[1], buf, sizeof(Uint8)*bmp->h);
        buf += sizeof(Uint8)*bmp->h;
    
        bmp->pixels[2] = (Uint8*)malloc(sizeof(Uint8)*bmp->h);
        memcpy(bmp->pixels[2], buf, sizeof(Uint8)*bmp->h);
        buf += sizeof(Uint8)*bmp->h;
    }
    
  • ffmpeg : mixing concat, apad and amerge in one call

    18 septembre 2016, par GeoffreyB

    I'm trying to merge multiple calls to ffmpeg into one single call.

    I have 2 images, 1 video, and 1 sound to merge together.

    Video: Image 1 (1sec), Image 2 (1sec -- fade onto video if possible), Video Sound: Sound --- once video start, merge both sounds

    I am able to perform those actions separately (generating a temporary video with images + video), and then merging both sounds, but I'd like to get something faster.

    How can I merge those two filters onto only one ?

    ffmpeg -loop 1 -framerate 60 -t 1 -i thumb.jpg -t 1 -f lavfi -i aevalsrc=0 -framerate 60 -t 1 -i theme.jpg -t 1 -f lavfi -i aevalsrc=0 -i video.mov -filter_complex '[0:0] [1:0] [2:0] [3:0] [4:0] [4:1] concat=n=3:v=1:a=1' tmp.mov

    ffmpeg -i tmp.mov -i audio.mp3 -filter_complex "[0:a]apad [b]; [b][1:a]amerge[a]" -map 0:v -map "[a]" -c:v copy -c:a mp3 -ac 2 -shortest out.mov

    My guess would be something like this ffmpeg -loop 1 -framerate 60 -t 1 -i thumb.jpg -framerate 60 -t 1 -i theme.jpg -i video.mov -i audio.mp3 -filter_complex "[0:0] [1:0] [2:0] [2:a] concat=n=3:v=1:a=1" -map 2:v -map "[a]" -c:v copy -c:a mp3 -ac 2 -shortest out.mov, but this one ends up with the following error: Stream specifier ':0' in filtergraph description [0:0] [1:0] [2:0] [2:a] concat=n=3:v=1:a=1 matches no streams.

    Any help would be appreciated ! (also if you know how to get the fade filter in my case, it would be great !)

  • CANNOT get FFserver stream going

    18 septembre 2016, par Euroclydon37

    I want to preface this question with the fact that I am very very new to ffmpeg and even newer to ffserver.

    I cannot, for the life of me, get this thing going. I get:

    "Too large number of skipped frames 882933314374 > 60000"

    Also, ffplay gives me first frame is no keyframe

    Here is my ffserver.conf file

    HTTPPort 8090
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 1000
    MaxClients 10
    MaxBandwidth 2000000
    NoDefaults
    
    ###############################################################################################
    
    
        File /tmp/test.ffm
        FileMaxSize 10000M
        ACL ALLOW localhost
    
    
    
    Format status
    
    # Only allow local people to get the status
        ACL allow localhost
    
    
    
        Feed test.ffm
        Format avi
        ACL ALLOW localhost
        ACL ALLOW 192.168.1.0
        NoAudio
        VideoSize 3840x2160
        VideoFrameRate 30
        Preroll 10
    
    
    ###############################################################################################
    

    And here is my ffmpeg command

    ffmpeg -i smaller.avi http://localhost:8090/test.ffm
    

    I've been fighting with this thing all day, googling like a madman the entire time. What am I doing wrong? Any help will be welcomed enthusiastically.