Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG Overlay not display when position increased

    20 février 2014, par user1250758

    I'm trying to create a video using ffmpeg using a background image, a centered main image and an audio file. All is working fine until I try to position the centered image where I want it, it seems to work with smaller x values correctly but when I increase it to the 290px required to center it it vanishes from the video completely. When set to 100 it displays correctly positioned 100px from the left. Command below, any ideas?

    ffmpeg -loop 1  -i background_1280x720.jpg  -i foreground_1000x1000.jpg -filter_complex "[0] scale=1280x720; [1] scale=500x500 [over]; [0][over] overlay=290:0"  -ss 30  -i audio.wav  -af afade=t=in:st=0:d=20  -t 40   -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest -pix_fmt yuv420p -s 1280x720 test.mp4
    

    When I change it to overlay=100:0 instead of overlay=290:0 all works as expected. Just to add the background image is already correctly sized but the foreground image is oversized and being scaled to 500x500.

  • Using ffmpeg break input file into 10min clips

    20 février 2014, par user3252877

    I'm using a Axis ip camera and i was successfully recording a video into path using FFMPeg with command ffmpeg -i rtsp://username:password@[camip]:rtspport/axis-media/media.amp -qscale 4 /path/to/output/file.mpeg

    now i would like to save a video clip using the same(FFMPEG) in 10 minutes video clips like break the video after every 10 min.

    is FFMPEG best option for that or suggest me any other(opensource) tool.

    thanks in adavnace.

  • Convert video on android using JNI

    20 février 2014, par user3292775

    I have loaded all the ffmpeg files on my application and everything is working fine. Now I am struggling to convert a video to a different format using the JNI. Anyone knows how can i convert a video with this library or what methods should i use?

  • PHP-FFMpeg prerequisites

    20 février 2014, par Jesse Adam

    I'm attempting to implement https://github.com/PHP-FFMpeg/PHP-FFMpeg

    I copied the src/FFMpeg folder to my includes folder and made sure my autoloader knows where to find everything.

    as a test I made a script that simply does:

    $ffmpeg = FFMpeg\FFMpeg::create();
    $video = $ffmpeg->open('video.mpg');
    

    I get:

    Fatal error: Class 'Doctrine\Common\Cache\ArrayCache' not found in /var/www/php/include/FFMpeg/FFProbe.php on line 203 
    

    My question is: does PHP-FFMPeg require Doctrine, because that is not stated in the documentation. What version do I need? Are there other prerequisites?

    I could create a new question for this, but I'm not sure if I should. I now have PHP-ffmpeg implemented. I'm using Laravel, however that should be irrelevant for this question. I'm trying to enable progress monitoring. It works, however I need to pass in an ID so I can update the correct key in memcache.

    $id = 12345;
    $format->on('progress', function ($audio, $format, $percentage) {
        //this works perfect, but doesn't tell me which item is being updated 
        Cache::put("progress", $percentage,  .25);
    
        //this does not work as I am unable to pass in $id, if I add it as the 4th argument above it will display the number of threads or something
        //Cache::put("{$id}_progress", $percentage,  .25);          
    });
    

    I need clarification on the "on" method. I looked through https://ffmpeg-php.readthedocs.org/en/latest/_static/API/ and was not able to figure out how this method works. Any help would be appreciated.

  • HLS Streaming using node JS

    20 février 2014, par Tirtha

    I'm trying to stream HLS content using node.js. And somehow it is not working. It'll be of great help if someone helps me out.

    Problem:- Trying to serve HLS content from node.js (not live stream, but a set of .ts files and .m3u8 playlist, or in other words VOD content)

    Folder Structure

    stream_test
    |--- app.js
    |--- node_modules
    |--- streamcontent
            |--- test.m3u8
            |--- segment0.ts
            |--- segment1.ts
            .
            .
            .
            |--- segment127.ts
    

    My app.js looks like this

    var http = require('http'),
        url = require('url'),
        path = require('path'),
        fs = require('fs');
    var mimeTypes = {
        "html": "text/html",
        "jpeg": "image/jpeg",
        "jpg": "image/jpeg",
        "png": "image/png",
        "js": "text/javascript",
        "css": "text/css",
        "ts": "video/MP2T",
        "m3u8": "application/vnd.apple.mpegurl"};
    
    http.createServer(function(req, res) {
        var uri = url.parse(req.url).pathname;
        var filename = path.join(process.cwd(), unescape(uri));
        var stats;
    
        console.log('filename '+filename);
    
        try {
            stats = fs.lstatSync(filename); // throws if path doesn't exist
        } catch (e) {
            res.writeHead(404, {'Content-Type': 'text/plain'});
            res.write('404 Not Found\n');
            res.end();
            return;
        }
    
    
        if (stats.isFile()) {
            // path exists, is a file
            var mimeType = mimeTypes[path.extname(filename).split(".")[1]];
            res.writeHead(200, {'Content-Type': mimeType} );
    
            var fileStream = fs.createReadStream(filename);
            fileStream.pipe(res);
        } else if (stats.isDirectory()) {
            // path exists, is a directory
            res.writeHead(200, {'Content-Type': 'text/plain'});
            res.write('Index of '+uri+'\n');
            res.write('TODO, show index?\n');
            res.end();
        } else {
            // Symbolic link, other?
            // TODO: follow symlinks?  security?
            res.writeHead(500, {'Content-Type': 'text/plain'});
            res.write('500 Internal server error\n');
            res.end();
        }
    
    }).listen(8000);
    

    The test.m3u8 looks like this

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-ALLOW-CACHE:YES
    #EXT-X-TARGETDURATION:19
    #EXT-X-PLAYLIST-TYPE:VOD
    #EXTINF:12.595922,
    segment0.ts
    .
    .
    .
    

    I used ffmpeg to create the segments and palylist

    ffmpeg -i video-a.mp4  -c:a libmp3lame -ar 48000 -ab 64k  -c:v libx264   -b:v 128k -flags -global_header -map 0 -f segment  -segment_list test.m3u8 -segment_time 30 -segment_format mpegts segment_%05d.ts
    

    Test Scenraio:- Works fine if served from Apache, does not if served from node.

    Test Tool:- VNC Player