Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • how to build ffmpeg shared libraries without version suffix

    31 mai 2016, par andruido

    is there a way i can configure to build ffmpeg shared libraries for android without version number suffixes? im able to build with different options but always get files like "libavcodec.so.57". i would need the libraries without suffixes like "libavcodec.so". i thought the option "--disable-symver" would do the trick but unfortunately it didn't. the problem is that i have a library (.so file) that depends on ffmpeg shared libraries without suffixes and therefore can't load those im getting built. i have followed mostly the instructions here.

  • FFMPEG Generate N Evenly Spaced PNG Screenshots

    31 mai 2016, par Kevin Sylvestre

    I am trying to generate 8 screenshots for an uploaded video using FFMPEG. I currently have:

    ffmpeg -i Trailer-720p.mov -r .2 -vcodec png Preview-%d.png

    Which generates a screenshot every 5 seconds. How can I add the ability to generate a screenshot for frames distributed over a percentage of total time. Thanks. Furthermore, is it possible to generate a screenshot at 50% for example? Thanks.

  • ffmpeg produces bad output when called from execve in c++

    31 mai 2016, par Arheisel

    im writing a c++ program that involves ffmpeg being called from a c++ program. a couple of days ago i got it working using std::system

    std::system("ffmpeg -threads auto -y -r 1.74659 -i /mnt/ev_ramdsk/1/%05d-capture.jpg -px_fmt yuv420p -preset ultrafast -r 10 /mnt/ev_ramdsk/1/video.mp4");
    

    but this only worked once now this produces .mp4 videos of 8MB or so that cannot be played anywhere.. so because of a suggestion in a previous question i moved to execve.

    Here is my code

    child_pid = fork();
            if(child_pid < 0){
                syslog(LOG_ERR, "ERROR: ffmpeg forking failed");
                return false;
            }
            else if(child_pid > 0){
                syslog(LOG_DEBUG, "DEBUG: forking succeeded, pid: %d", child_pid);
            }
            else if(child_pid == 0){
                char *newargv[16];
                for(int i=0; i < 15; i++) newargv[i] = (char *)malloc(sizeof(char) * 60); //allocate the array in memory
                strcpy(newargv[0], "/usr/bin/ffmpeg");
                strcpy(newargv[1], "-threads");
                strcpy(newargv[2], "auto");
                strcpy(newargv[3], "-y");
                strcpy(newargv[4], "-framerate");
                tempSS << fps;
                strcpy(newargv[5], tempSS.str().c_str());
                tempSS.str(std::string());
                strcpy(newargv[6], "-i");
                strcpy(newargv[7], std::string(conf->dir_ram + dest + "%05d-capture.jpg").c_str());
                strcpy(newargv[8], "-pix_fmt");
                strcpy(newargv[9], "yuv420p");
                strcpy(newargv[10], "-preset");
                strcpy(newargv[11], "ultrafast");
                strcpy(newargv[12], "-r");
                strcpy(newargv[13], "25");
                strcpy(newargv[14], std::string(conf->dir_ram + dest + "video.mp4").c_str());
                newargv[15] = NULL;
    
                for(int i=0; i < 15; i++){
                    tempSS << "newargv[" << i << "] = \"" << newargv[i] << "\", ";
                }
                syslog(LOG_DEBUG, "DEBUG:newargv: %s", tempSS.str().c_str());
                tempSS.str(std::string());
    
                char *newenviron[] = { NULL };
    
                if(execve(newargv[0], newargv, newenviron) == -1){
                    syslog(LOG_ERR, "ERROR: execve returned -1");
                    exit(EXIT_SUCCESS);
                }
            }
    
            wpid = wait(&status);
            syslog(LOG_DEBUG, "DEBUG: ffmpeg child terminated, pid: %d, status: %d", wpid, status);
    

    the output of syslog is:

    May 28 00:25:03 SERVER dt_ev_maker[10471]: DEBUG: forking succeeded, pid: 10658
    May 28 00:25:03 SERVER dt_ev_maker[10658]: DEBUG:newargv: 
    newargv[0] = "/usr/bin/ffmpeg", 
    newargv[1] = "-threads", 
    newargv[2] = "auto", 
    newargv[3] = "-y", 
    newargv[4] = "-framerate", 
    newargv[5] = "1.45097", 
    newargv[6] = "-i", 
    newargv[7] = "/mnt/ev_ramdsk/1/%05d-capture.jpg", 
    newargv[8] = "-pix_fmt", 
    newargv[9] = "yuv420p", 
    newargv[10] = "-preset", 
    newargv[11] = "ultrafast", 
    newargv[12] = "-r", 
    newargv[13] = "25", 
    newargv[14] = "/mnt/ev_ramdsk/1/video.mp4",
    May 28 00:25:03 SERVER dt_ev_maker[10471]: DEBUG: ffmpeg child terminated, pid: 10658, status: 256
    

    in this case the video has about 90B size and is also corrupted.

    NOTE: if i run the same command from the command line the video can be played normally.

    what am i doing wrong?

    Thanks in advance!

    EDIT

    Thanks to ouroborus (changes submitted above) i got it to make 18MB videos, but i cant play them.

  • ffmpeg memery leak with av_read_frame

    31 mai 2016, par Link

    I use av_read_frame in two ways below:

    1.

    for(;;){
            if (av_read_frame(pFormatCtx, packet) >= 0){
                av_packet_unref(packet);
            }
        }
    

    2.

       for(;;){
            packet = av_packet_alloc();
            if (av_read_frame(pFormatCtx, packet) >= 0){
                av_packet_free(&packet);
            }
        }
    

    Noting to do but read file and call free methods with FFMPEG APIs. Both have a memery leak problem.(1.72GB film file got 300MB memory increment) Anyone got rosulation?

  • Redirect FFMPEG's output to multiple named pipes on Windows

    31 mai 2016, par tearvisus

    I am trying to stream video and audio data into two separate named pipes on Windows.

    ffmpeg.exe -f dshow -i video="My camera name":audio="My microphone name" -map 0:1 -ac 1 -f f32le \\.\pipe\audioStream -map 0:0 -f mjpeg \\.\pipe\videoStream
    

    The problem is that FFMPEG does not seem to understand that the outputs \\.\pipe\audioStream and \\.\pipe\videoStream are pipes and treats them like files.

    1. If the pipes are already created when the FFMPEG starts, it wants to overwrite them and fails.
    2. Otherwise, it complains that the path does not exist and fails.

    As far as I understand, specifying the pipe: protocol should do the trick, but I can't figure out how to use it properly, even with a single pipe. I have tried:

    1. pipe:pipeName
    2. pipe:pipe\pipeName
    3. pipe:\\.\pipe\pipeName
    4. pipe://pipeName
    5. pipe://pipe\pipeName
    6. pipe://\\.\pipe\pipeName

    I always end up with the same result: the output is written to the console and not to the pipe. If the pipe already exists when the FFMPEG starts, nothing connects to the pipe.

    Is it possible to use FFMPEG with named pipes on Windows? If yes, what is the proper way to do this?