Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to capture audio in an xvfb system using ffmpeg

    12 juin 2016, par somya bhargava

    Want to capture the audio using ffmpeg Went to this link

    The error coming on the first one is ffmpeg exited with code 1: hw:0: Input/output error

    And the pulse one is running on my laptop but not on the server i think some missing drivers

    ffmpeg exited with code 1: default: No such process

  • Killing all child processes

    12 juin 2016, par ErraticFox

    I have written a onclick function that runs child process for a command line for ffmpeg. Though I can't seem to force close or kill the process in the middle of it. I've tried multiple ways such as child.kill() along with SIGINT, SIGKILL, SIGHUP, SIGQUIT, and SIGTERM and it continuously runs in the background still until finished or killed in the task manager. So how can I kill all the process related to the exec?

    Here's my current code:

    function submitBtn() {
        var selectVal1 = $("#inputFile1 option:selected").val(),
            selectVal2 = $("#inputFile2 option:selected").val(),
            selectOpt2 = $("#inputFile2 option:selected").text().toLowerCase()
    
        if (!selectVal1 || !selectVal2) {
            Materialize.toast('Please select your formats', 4000)
        } else if ($("#uploadFile").val() === '') {
            Materialize.toast('Please select your file', 4000)
        } else {
            var process = require("child_process")
            var inputDir = uploadFile.files[0].path
            var dir = inputDir.split("\\")
            var pop = dir.pop()
            var outputDir = dir.join("\\")
            var cmd = `ffmpeg -y -i "${inputDir}" "${outputDir}\\output.${selectOpt2}"`
    
            $("#load").removeClass("disabledLoad")
            func = process.exec(cmd, function(error, stdout, stderr) {})
    
            func.on('exit', function() {
                $("document").ready(function() {
                    $("#load").addClass("disabledLoad")
                    Materialize.toast('Conversion compelete!', 4000)
                })
            })
    
        }
    }
    
    function exitBtn() {
        //var remote = require('electron').remote
        //var window = remote.getCurrentWindow()
        //window.close()
        func.kill()
    }
    

    I even tried renaming process to proc and then doing

        process.on('exit', function () {
        console.log('process is about to exit, kill ffmpeg');
        func.kill()
    })
    

    in exitBtn but still nothing. It doesn't give errors or log my string I put.

  • Linux : The man pages about ffmpeg library

    12 juin 2016, par ldkxingzhe

    Just as titile. I want to install man pages about ffmpeg library on linux. when type man "av_register_all", show me the description just as "man printf".

    I know i should put the pages to /usr/local/man. but where is the pages about ffmpeg library

  • FFMpeg libswscale XBGR32 to NV12 almost working but colors are wrong

    12 juin 2016, par PhilBot

    I am getting a Linx DMA-BUF from the GPU in XBGR32 format and I need to use FFMpeg's libswscale to convert it on the ARM to NV12.

    I've been able to almost get it working based on various SO posts and the documentation.

    Here is the LCD screen that is the actual output of the GPU: enter image description here

    Here is the encoded data from the NV12 frame created by libswscale - it should show the same colors as the screen: enter image description here

    Please note that the pictures were not taken at exactly the same time.

    What am I doing wrong?

    Here is the relevant part of my code:

    /* Prepare to mmap the GBM BO */
    union gbm_bo_handle handleUnion = gbm_bo_get_handle(bo);  
    struct drm_omap_gem_info req;
    req.handle = handleUnion.s32;    
    ret = drmCommandWriteRead(m_DRMController.fd, DRM_OMAP_GEM_INFO,&req, sizeof(req));
    if (ret) {  
        qDebug() << "drmCommandWriteRead(): Cannot set write/read";
    }   
    
    // Perform actual memory mapping of GPU output    
    gpuMmapFrame = (char *)mmap(0, req.size, PROT_READ | PROT_WRITE, MAP_SHARED,m_DRMController.fd, req.offset);
    assert(gpuMmapFrame != MAP_FAILED);
    
    // Use ffmpeg to do the SW BGR32 to NV12   
    static SwsContext *swsCtx = NULL;    
    int width    = RNDTO2( convertWidth );    
    int height   = RNDTO2( convertHeight );    
    int ystride  = RNDTO32 ( width );    
    int uvstride = RNDTO32 ( width / 2 );    
    int uvsize   = uvstride * ( height / 2 );    
    void *plane[] = { y, u, u + uvsize, 0 };    
    int stride[] = { ystride, uvstride, uvstride, 0 };    
    
    // Output of GPU is XBGR32    
    // #define V4L2_PIX_FMT_XBGR32  v4l2_fourcc('X', 'R', '2', '4') /* 32  BGRX-8-8-8-8  */    
    swsCtx = sws_getCachedContext( swsCtx, convertWidth, convertHeight, AV_PIX_FMT_BGR32, width, height, AV_PIX_FMT_NV12, 
                               SWS_FAST_BILINEAR , NULL, NULL, NULL );  
    int linesize[1] = { convertWidth * 4 };    
    const uint8_t *inData[1] = { (uint8_t*)gpuMmapFrame };    
    if ( gpuMmapFrame ) {    
        sws_scale( swsCtx, (const uint8_t *const *)inData, linesize, 0, convertHeight, (uint8_t *const *)plane, stride );    
    }        
    
    // Unmap it    
    munmap(gpuMmapFrame,req.size);
    
    // Now send the frame to the encoder    
    dce.submitFrameToEncode(swEncodeBufferNV12);
    
  • Ffmpeg is not always converting correctly

    11 juin 2016, par Lewis Day

    I'm having some problems when I'm using this command to convert video formats It sometimes works and sometimes it doesn't. For .avi files it works for .3gpp only converts audio and for .flv it completely doesn't work is there something that I'm doing wrong basically the $newfilename will only ever be video formats and the output format will always be a .mp4 Thankyou for any help

    ffmpeg -i /path/' . $newfilename . ' -vcodec copy -acodec copy /path/' . $rand . '.mp4'
    

    When I try and convert a .flv to .mp4 this is what is produces

    ffmpeg version 0.10.15 Copyright (c) 2000-2014 the FFmpeg developers
      built on Aug 30 2014 15:49:19 with gcc 4.4.7 20120313 (Red Hat 4.4.7-3)
      configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffm                      peg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-                      D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --ena                      ble-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enab                      le-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-op                      enal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspee                      x --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x1                      1grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-                      gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
      libavutil      51. 35.100 / 51. 35.100
      libavcodec     53. 61.100 / 53. 61.100
      libavformat    53. 32.100 / 53. 32.100
      libavdevice    53.  4.100 / 53.  4.100
      libavfilter     2. 61.100 /  2. 61.100
      libswscale      2.  1.100 /  2.  1.100
      libswresample   0.  6.100 /  0.  6.100
      libpostproc    52.  0.100 / 52.  0.100
    Input #0, flv, from '/path/101.flv':
      Metadata:
        starttime       : 0
        totalduration   : 39
        totaldatarate   : 639
        bytelength      : 3096565
        canseekontime   : true
      Duration: 00:00:38.66, start: 0.000000, bitrate: 640 kb/s
        Stream #0:0: Video: flv1, yuv420p, 426x240, 581 kb/s, 30 tbr, 1k tbn, 1k tbc
        Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s
    [buffer @ 0x679ce0] w:426 h:240 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
    Incompatible sample format 's16' for codec 'aac', auto-selecting format 'flt'
    [libx264 @ 0x679640] using cpu capabilities: none!
    [libx264 @ 0x679640] profile High, level 2.1
    [libx264 @ 0x679640] 264 - core 120 r2151 a3f4407 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http                      ://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7                       psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fas                      t_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0                       constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 k                      eyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6                      0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [NULL @ 0x682a60] Codec is experimental but experimental codecs are not enabled, see -strict -2
    Output #0, mp4, to 'path/55271313.mp4':
      Metadata:
        starttime       : 0
        totalduration   : 39
        totaldatarate   : 639
        bytelength      : 3096565
        canseekontime   : true
        Stream #0:0: Video: h264, yuv420p, 426x240, q=-1--1, 90k tbn, 30 tbc
        Stream #0:1: Audio: none, 22050 Hz, stereo, flt, 128 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (flv -> libx264)
      Stream #0:1 -> #0:1 (mp3 -> aac)
    Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate                      , width or height