Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Streaming microphone audio to tag with FFmpeg

    16 octobre 2013, par noodleboy347

    I've been working on a nodejs server that streams a live webcam feed and I've been looking for a way to get audio working but I'm completely stumped.

    The video is being streamed onto a canvas element with jsmpeg, and is being streamed with the following command (I'm not sure that this is even successfully streaming audio):

    ffmpeg -s 640x480 -f vfwcap -i video="/dev/video0":audio="Microphone" -f mpeg1video -acodec libmp3lame -b:v 30k -r 24  -b:a 24k -ar 22050 http://website.com:8082
    

    So what I'm wondering is, maybe there's a possible way to stream the audio with the HTML5 audio tag, or maybe even use WebM, just any good solution. What's the best way for streaming live video and audio with nodejs?

  • Does MediaCodec truncate incoming packets for decoding ?

    15 octobre 2013, par mathieujofis

    I'm using MediaCodec to decode h264 packets that were encoded with ffmpeg. When I decode with ffmpeg, the frames display fine. However, when I decode with the MediaCodec hardware decoder I sometimes get black bars that show up in the middle of the frame. This only happens if the encoding bitrate is set high enough (say upwards of 4000000) so that any given AVPacket size becomes above 95000 or so. It seems like MediaCodec (or the underlying decoder) is truncating the frames. Unfortunately, I need the quality so the bitrate can't be turned down. I've verified that the frames aren't being truncated elsewhere, and I've tried setting MediaFormat.KEY_MAX_INPUT_SIZE to something higher.

    Has anyone ran into this issue or know of a way I can work around it?

    I've attached an image of random pixels that I rendered in OpenGL and then decoded on my Galaxy S4.

    a busy cat

  • 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