Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg command and args execute successfully with child_process.exec() but not child_process.spawn()

    15 octobre 2013, par Zugwalt

    I am trying to use ffmpeg to add text to a video via the drawtext filter from within node.js in a windows environment.

    I have a command and arguments that work in the command line and when executed using the child_process module's exec function, but it encounters an error when the same arguments are used with the spawn function.

    The below code illustrates the problem:

    var child_process = require('child_process');
    
    var cmd = 'ffmpeg';
    
    var args = [ '-i',
                 'c:\\path\\to\\my\\inputfile.mp4',
                 '-vf',
                 'drawtext="fontfile=/Windows/Fonts/arial.ttf:text=\'Hello World\':fontcolor=white@0.6:fontsize=70:x=0:y=40"',
                 '-y',
                 'c:\\path\\to\\my\\outputfile.mp4' ];
    
    // Above creates the command line equivalent of:
    // ffmpeg -i c:\path\to\my\inputfile.mp4 -vf drawtext="fontfile=/Windows/Fonts/arial.ttf:text='Hello fluent text':fontcolor=white@0.7:fontsize=70:x=0:y=40" -y c:\path\to\my\outputfile.mp4
    // this works when run from the command line
    
    var execCmd = cmd+' '+args.join(' ');
    
    child_process.exec(execCmd, function (error, stdout, stderr) {
            /* ffmpeg runs fine, adding the text to the video */
    
            var spawn = child_process.spawn(cmd,args);
    
            spawn.on('close', function (code) {
                /* ffmpeg fails, with standard error (obtained via spawn.stderr) reading:
                   Could not load font ""fontfile=/Windows/Fonts/arial.ttf": impossible to find a matching font
                   Error initializing filter 'drawtext' with args '"fontfile=/Windows/Fonts/arial.ttf:text=Hello fluent text:fontcolor=white@0.6:fontsize=70:x=0:y=40"'
                */
            });
        });
    

    Based on the error message:

    Could not load font ""fontfile=/Windows/Fonts/arial.ttf": impossible to find a matching font

    And comparing it to giving ffmpeg a bogus font on the command line:

    Could not load font "/Windows/Fonts/bogus.ttf": impossible to find a matching font

    It seems the problem is that when executed from spawn the drawtext argument is incorrectly parsed and "fontfile= is incorrectly making its way into the font's path. This does not happen when the same argument is executed with exec or from the command line. Is there any additional escaping that needs to be done when executing using spawn?

  • how to call activex control method with multi parameter from java script ?

    15 octobre 2013, par user2882620

    I working on a project that requires me to call activex control function from dll using javascript. i am able to call method that has 1 parameter and method with no parameter, but i am not able to call those methods that has multiple parameter. The method that i am trying to call is a put method.

    STDMETHODIMP CFFMpeg::put_Snapshot(BSTR Path,long newVal){}
    

    trying to call this method using following java script code.

    document.getElementById('GFFMpeg1').snapshot(1) = 'qwerty';
    document.getElementById('GFFMpeg1').snapshot(2) = 1;
    

    but i am not getting anything.

    Please help me by providing appropriate solution to this problem. i've googled it alot but didn't find any solutions.

    thanks

  • FFMpeg Batch Image + Multiple Audio to video

    15 octobre 2013, par Peco

    Im trying to do the following with FFMpeg I want to create multiple videos with one image and different audio files (music albums). These are my own albums so I have rights to do so before you ask. I have 100's of audio files to stick up on youtube.

    Is there a way I can create this in batch so i can just load one image (album cover) and multiple audio files (the album tracks) and get videos to the tracks length automatically?

    Appreciate any help

  • Create Screenshot/Thumbnail from mp4 WITHOUT FFMPEG PHP [on hold]

    15 octobre 2013, par user2484648

    im looking to take screenshots/a thumbnail from an mp4 video with php. ive been trying to find alternate solutions, but all ive come across so far is ffmpeg which i would prefer not to use.

    any help would be greatly appreciated.

  • how to compress (shrink) the file size of the Mp4 video in android ?

    15 octobre 2013, par Sudharsan Linkan Tsr

    I have developed a application with video recording and uploading. Before upload i need to compress the video file. I'm using ffmpeg for pause/record video recording process in android. i expecting a more optimized small size video output for further process. Thanks in advance.