Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Compile ffmpeg for GPL use on Yocto

    15 février 2017, par David Bensoussan

    From what I understood here, if I compile with the flag --enable-gpl, ffmpeg can be added in a commercial product. In the recipe, there is: PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl"

    Thus, I created a ffmpeg_%.bbappend containing:

    PACKAGECONFIG_append ="gpl"
    

    But it seems I still have to put a value in LICENSE_FLAGS_WHITELIST, most likely commercial. Is it a mistake from me or is it not handled properly by the main recipe?

    Thanks

  • How to concatenate two mp4 files using ffmpeg C code ?

    15 février 2017, par Jerikc XIONG

    I found many links about concatenating multiple mp4 files using ffmpeg command on shell environment. Such as:

    Concatenate two mp4 files using ffmpeg

    But I didn't find any information about using C code. There are some code snippet, but it seems not working.

    static int setargs(char *args, char **argv)
    {
        int count = 0;
    
        while (isspace(*args)) ++args;
        while (*args) {
            if (argv) argv[count] = args;
            while (*args && !isspace(*args)) ++args;
            if (argv && *args) *args++ = '\0';
            while (isspace(*args)) ++args;
            count++;
        }
        return count;
    }
    
    char **parsedargs(char *args, int *argc)
    {
        char **argv = NULL;
        int    argn = 0;
    
        if (args && *args
            && (args = strdup(args))
            && (argn = setargs(args,NULL))
            && (argv = malloc((argn+1) * sizeof(char *)))) {
              *argv++ = args;
              argn = setargs(args,argv);
        }
    
        if (args && !argv) free(args);
    
        *argc = argn;
        return argv;
    }
    
    void freeparsedargs(char **argv)
    {
        if (argv) {
            free(argv[-1]);
            free(argv-1);
        }
    }
    
    int main()
    {
        char **argv;
        char *cmd;
        int argc;
    
        cmd = "ffmpeg -i infile outfile";
        argv = parsedargs(cmd,&argc);
        ffmpeg(argc, argv);
    }
    

    Can FFmpeg be used as a library, instead of a standalone program?

    How to do it by using ffmpeg C code ?

  • Cannot read xvid video with opencv in python on mac

    15 février 2017, par crazjo

    I have been trying for hours to read a xvid .avi file on my mac with python 2.7 and opencv. I have installed all the latest versions using brew and opencv is working in python and I can open images and other movie files but when I try to read a xvid avi file with

    cap.cv2.VideoCapture('video.AVI')
    ret, frame = cap.read()
    

    It fails as frame is empty. I have installed ffmpeg with brew and x264 as well and ran brew doctor. I am totally lost what to do now. Happy to provide more information if needed. I hope someone can help me, thanks.

  • How i can resize rectangular video into square size without loosing quality ?

    15 février 2017, par Srinivas 25

    Our challenge is how do we can resize 1080*720 format videos to 720*720 format without loosing quality. Hence we are using ffmpeg for video encoding, please advice any tool or tips to achieve this?

  • How to use trap to terminate while loop containing ffmpeg fed by redirect from /dev/null ?

    15 février 2017, par Lorccan

    I discovered here Loop calls process that takes a long time to complete. How do I break out of it? that piping from find to a while loop that calls an ffmpeg cli [HandBrakeCLI] will not process more than one input file because ffmpeg has a quirk that it 'eats' all the input list in one go and 'starves' the loop.

    The solution was to redirect from /dev/null per http://mywiki.wooledge.org/BashFAQ/089 and that works fine. However, it brings me back to the original problem and the question I set out to solve:

    Because /dev/null now has a complete list of all the files feeding HandBrakeCLI, ctrl-c on its own is not enough to quit the loop.

    I have tried various permutations of trap, but I can't get it to do anything other than stop HandBrakeCLI processing the current input before it moves on to the next one. Instead of terminating the loop immediately, it also processes the mv right after the HandBrakeCLI line.

    So, there are two things I am not getting here: 1. How do I terminate everything with a ctrl-c or kill command? 2. If not dealt with by (1.), how do I prevent the mv inside the loop from being executed?

    For the sake of addressing the question, this is the simplified version of the code:

    #!/bin/bash
    
    source_dir="/Volumes/Volumename"
    dest_dir="/Volumes/Volumename/Converted/"
    finished_dir="Volumes/Volumename/Processed/"
    
    
    find "$source_dir" -type d -name "VIDEO_TS" | while read -r dir; do
      name=${dir%/VIDEO_TS}
      mov_dir=${dir%/*}
      name=${name##*/}
      ./HandBrakeCLI -i "$dir" -o "$dest_dir/$name.m4v" null
      mv "$mov_dir" "finished_dir"
    done