Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Compiling FFMpeg Error — Need to recompile something with -fPIC, but don't know where the thing is

    1er mai 2014, par nectaris

    I'm trying to compile FFMpeg with make after running ./configure --enable-shared --enable-pic, but am getting the following error, which stops completion of the compilation:

    /usr/bin/ld: libavutil/intfloat_readwrite.o: relocation R_X86_64_PC32 against undefined symbol ldexp@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value

    I know I need to recompile something with -fPIC as indicated, but I'm not sure exactly what needs to be recompiled. I know that -fPIC is an option of GCC, but again, I just need a shove in the right direction as to what actual files need to be recompiled. Or should I modify the Makefile?

    I apologize if the answer's right in front of me or something -- this is rather new territory.

  • Cannot concatenate videos ffmpeg [on hold]

    1er mai 2014, par Paul Prescod

    I have a bitmap that I would like to concatenate to the front of many videos as a sort of title screen or disclaimer screen.

    I try to turn it into a video with the same attributes as the rest of the video. So first I introspect the video:

    ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
      built on Apr 11 2014 22:50:38 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
      libavutil      52. 66.100 / 52. 66.100
      libavcodec     55. 52.102 / 55. 52.102
      libavformat    55. 33.100 / 55. 33.100
      libavdevice    55. 10.100 / 55. 10.100
      libavfilter     4.  2.100 /  4.  2.100
      libavresample   1.  2.  0 /  1.  2.  0
      libswscale      2.  5.102 /  2.  5.102
      libswresample   0. 18.100 /  0. 18.100
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'EO1.mp4':
      Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.78.3
      Duration: 00:00:17.77, start: 0.000000, bitrate: 582 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 512 kb/s, 23.98 fps, 23.98 tbr, 1199 tbn, 47.96 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
    

    Then I try and create a similar file:

    /usr/local/Cellar/ffmpeg/2.2.1/bin/ffmpeg -y -loop 1 -i Disclaimer.png -c:v libx264 -r 23.98 -t 5 -pix_fmt yuv420p -profile:v main disclaimer.mp4

    It seems to work okay. The video plays I would expect it to. The attributes turn out very similar. Here is a diff:

    < Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'disclaimer.mp4':
    ---
    > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'EO1.mp4':
    18,20c18,21
    <     encoder         : Lavf55.33.100
    <   Duration: 00:00:05.01, start: 0.000000, bitrate: 21 kb/s
    <     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 17 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc (default)
    ---
    >     creation_time   : 1970-01-01 00:00:00
    >     encoder         : Lavf52.78.3
    >   Duration: 00:00:17.77, start: 0.000000, bitrate: 582 kb/s
    >     Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 512 kb/s, 23.98 fps, 23.98 tbr, 1199 tbn, 47.96 tbc (default)
    21a23
    22a25,28
    >     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
    >     Metadata:
    >       handler_name    : SoundHandler
    

    But when I try to concatenate, I get errors.

    > $ cat temporary.txt 
    
        file disclaimer.mp4
        file EO1.mp4
    

    /usr/local/Cellar/ffmpeg/2.2.1/bin/ffmpeg -y -f concat -i temporary.txt -c copy output.mp4

    [concat @ 0x7fd880806600] Estimating duration from bitrate, this may be inaccurate
    Input #0, concat, from 'temporary.txt':
      Duration: 00:00:00.02, start: 0.000000, bitrate: 17 kb/s
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 584x328 [SAR 1:1 DAR 73:41], 17 kb/s, 23.98 fps, 23.98 tbr, 19184 tbn, 47.96 tbc
    Output #0, mp4, to 'output.mp4':
      Metadata:
    encoder         : Lavf55.33.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 584x328 [SAR 1:1 DAR 73:41], q=2-31, 17 kb/s, 23.98 fps, 19184 tbn, 19184 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    [mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93600, current: 5951; changing to 93601. This may result in incorrect timestamps in the output file.
    [concat @ 0x7fd880806600] Invalid stream index 1
    [mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93601, current: 6001; changing to 93602. This may result in incorrect timestamps in the output file.
    [concat @ 0x7fd880806600] Invalid stream index 1
    [mp4 @ 0x7fd880829a00] Non-monotonous DTS in output stream 0:0; previous: 93602, current: 6051; changing to 93603. This may result in incorrect timestamps in the output file.
    

    ...

    frame=  546 fps=0.0 q=-1.0 Lsize=    1127kB time=00:00:04.90 bitrate=1882.9kbits/s    
    video:1123kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.349865%
    

    The output looks like it only has my disclaimer file in it, not the rest of the video.

    I'm also confused why it feels like it needs to "estimate" anything. It knows the input FPS and input durations. I'm not sure if this is the problem or not. Maybe its just a bug.

  • FFmpeg ignores quality parameter

    1er mai 2014, par John Smith

    this is how I use FFmpeg

    ffmpeg -f dshow -i video="UScreenCapture" -vcodec libx264 -q 26 -f flv output.flv
    

    the thing is, the quantity is always 28, ffmpeg ignores that. How to fix this? I need a "flash" codec anyway, to stream to twitch tv

  • Error while build ffmpeg for iOS

    30 avril 2014, par AntonD

    I'm trying to build fmmpeg for iOS with the following config:

    ./configure --prefix=build/armv7 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avutil --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" --target-os=darwin --cc=gcc --extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=6.0" --extra-ldflags="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=6.0" --arch=arm --cpu=cortex-a9 --enable-pic

    when i try to make it i'm receiving the follow error:

    AS libavcodec/arm/vc1dsp_neon.o libavcodec/arm/vc1dsp_neon.S:751:10: error: unexpected token in argument list ra .dn d28.i8 ^ libavcodec/arm/vc1dsp_neon.S:752:10: error: unexpected token in argument list rb .dn d29.i8 ^ libavcodec/arm/vc1dsp_neon.S:753:10: error: unexpected token in argument list rc .dn d30.i8 ^ libavcodec/arm/vc1dsp_neon.S:754:10: error: unexpected token in argument list rd .dn d31.i8 ^ libavcodec/arm/vc1dsp_neon.S:757:14: error: invalid operand for instruction vmov ra, #4 ^ libavcodec/arm/vc1dsp_neon.S:758:14: error: invalid operand for instruction vmov rb, #53 ^ libavcodec/arm/vc1dsp_neon.S:759:14: error: invalid operand for instruction vmov rc, #18 ^ libavcodec/arm/vc1dsp_neon.S:760:14: error: invalid operand for instruction vmov rd, #3 ^ libavcodec/arm/vc1dsp_neon.S:864:10: error: unexpected token in argument list ra .dn d28.i16 ^ libavcodec/arm/vc1dsp_neon.S:865:10: error: unexpected token in argument list rb .dn d29.i16 ^

    what could be the error?

  • Use ff mpeg inside a loop to create thumbnails

    30 avril 2014, par Paul Ledger

    I have an uploader which I am creating for a site. The uploader is a jquery plugin which I am on creating that allows single of multiple uploads of images or videos.

    The uploader works with no problems and ffmpeg does create thumbnails no problem. However I have a max file size of 1GB which I will implement to the total of uploads so that users cannot upload to much in one go. But for testing I haven't yet so I can test the limits of the uploader capabilities before adding restrictions.

    I have 4 videos I am using to test 246mb each. The files upload and move to the folder set on the test server (localhost) but the thumbnails don't create as the PHP script extends the maximum time limit. The easy option would be to change this in php.ini easily.

    The problem is thought the progress bar only tracks the upload not the ffmpeg conversion. Is there a way of tracking this in my progress bar or running this as a background task with multiple video files.

    It might be worth mentioning but with smaller videos, under 70mb each there is no problem at all thumbnails are created but still after the progress bar reaches 100%.

    If it helps heres the relevant sections of the code. I can add the full source on git if needed. But I do fear that the answer will be no or alter the php.ini file

    JQuery/ Ajax:

    $.ajax({
            url: options.processor,
            type: "POST",
            data: formdata,
            processData: false,
            contentType: false,
            dataType:"JSON",
            beforeSend: init,
            error: error,
            xhr: function() {
                var myXhr = $.ajaxSettings.xhr();
                if(myXhr.upload){
                    myXhr.upload.addEventListener('progress',uploadProgress, false);
                }
                return myXhr;
            },
            success: onComplete
        });
    
    var uploadProgress = function(e){
            if(e.lengthComputable){
                if(options.single === true){
                    $('#'+options.counter).html('File 1 of 1');
                }else{
                    $('#'+options.counter).html('Files '+ item_count +' of ' + item_count + ' uploading');  
                }
                var p = (e.loaded / e.total) * 100;
                $('#'+options.progress_text).html(Math.round(p) + '%');
                $('#'+options.progress_bar).width(p + '%');
            }
        }
    

    PHP:

    if(!empty($_FILES['file'])){
        if(!empty($_POST['single'])){
            //single file upload
            if($_FILES['file']['error'] === 0){
                $temp = $_FILES['file']['tmp_name'];
                $name = $_FILES['file']['name'];
                $ext = explode('.',$name);
                $ext = strtolower(end($ext));
                $file = md5($temp).time().'.'.$ext;
                if(in_array($ext,$allowed) === true &&  move_uploaded_file($temp,"../uploads/{$file}") === true){
                    $succedeed[] = array('name' => $name,'file' => $file,'type'=>'image');              
                }else{
                    $failed[] = array('name' => $name, 'file' => $file, 'error' => 'File type not allowed');
                }
            }
        }else{
            //multiple file upload
            foreach($_FILES['file']['name'] as $key => $name){
                if($_FILES['file']['error'][$key] === 0){
                    $temp = $_FILES['file']['tmp_name'][$key];
                    $ext = explode('.',$name);
                    $ext = strtolower(end($ext));
                    $_file = md5($temp).time();
                    $file = $_file.'.'.$ext;
                    if(in_array($ext,$allowed) === true &&  move_uploaded_file($temp,"../uploads/{$file}") === true){
                        $file_type = explode('/',$_FILES['file']['type'][$key]);
                        if($file_type[0] === 'image'){
                            echo 'image';
                            $succedeed[] = array('name' => $name,'file' => $file, 'type' => 'image');               
                        }else{
                            $ffmpeg = 'ffmpeg';
                            $output = dirname(__DIR__).'/uploads/thumbs/'.$_file.'.jpg';
                            $input = dirname(__DIR__).'/uploads/'.$file;
                            $mov = new ffmpeg_movie($input);
                            $d =  $mov->getDuration();
                            $iscopy = $mov->getCopyright();
                            $h = $mov->getFrameHeight();
                            $w = $mov->getFrameWidth();
                            $pos = ceil((int)$d /3);
                            $size = $w.'x'.$h;
                            $cmd = "ffmpeg -i $input -an -ss $pos -s $size $output";
                            shell_exec($cmd);
                            $succedeed[] = array('name' => $name,'file' => '/thumbs/'.$_file.'.jpg', 'type' => 'video');                
                        }
    
                    }else{
                        $failed[] = array('name' => $name, 'file' => $file, 'error' => 'File type not allowed');
                    }
                }
            }
        }
    }
    

    **UPDATE the process of converting the files to thumbnails takes less time if I drop the posotion of where the thumb is taken from ie:

    $cmd = "ffmpeg -i $input -an -ss $pos -s $size $output";
    

    would become

    $cmd = "ffmpeg -i $input -an -ss 3 -s $size $output";
    

    I presume this is because ffmpeg plays the video until it gets to that point in the video to take the thumbnail. There for if the video is 5mins and the the thumb is taken at 2.30 then each conversion would take 2 min 30. I think I answered my own question here but take the thumbnail form somewhere between 1 - 5 seconds. Or alternately add a second progress bar into the onComplete handler which would calculate the time this would take and display it to the user.