Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • 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
    
  • Compile FFmpeg as iOS 8 Framework

    11 juin 2016, par zebeurton

    I successfully compiled FFmpeg with iOS 8.2 SDK thanks to https://github.com/kewlbear/FFmpeg-iOS-build-script and last version of gas-preprocessor (https://github.com/libav/gas-preprocessor).

    However, I would like to package FFmpeg libraries as a iOS 8 dynamic framework due to legal constraints. I found resources to create iOS 8 dynamic framework however I cannot find any solution for FFmpeg.

    Can anyone help me to package these librairies ? Thanks David

  • Using FFmpeg without NDK in android

    11 juin 2016, par Butani Vijay

    I go though many site and search regarding "FFMPEG" implementation for android project.

    Most solution founded are using NDK.

    but i want to use FFmpeg without using NDK as i found in This Link

  • Configure ffmpeg to work with native client

    11 juin 2016, par Mohammad Abu Musa

    I followed the steps https://chromium.googlesource.com/webports/+/master to port ffmpeg to native client. I do not know what is the issue here. here are the configuration and here what I get

    NACL_ARCH=pnacl TOOLCHAIN=pnacl make ffmpeg

    Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\@anchor{ <-- HERE (?:[^\}]*)\}/ at /home/user/Desktop/webports/src/out/build/ffmpeg/ffmpeg-2.6.1/doc/texi2pod.pl line 387. MAN doc/ffmpeg.1 MAN doc/ffprobe.1 MAN doc/ffmpeg-all.1 MAN doc/ffprobe-all.1 LD ffmpeg_g LD ffprobe_g /home/user/Desktop/webports/src/out/build/ffmpeg/ffmpeg-2.6.1/Makefile:124: recipe for target 'ffprobe_g' failed make[1]: *** [ffprobe_g] Error 247 make[1]: *** Waiting for unfinished jobs.... /home/user/Desktop/webports/src/out/build/ffmpeg/ffmpeg-2.6.1/Makefile:124: recipe for target 'ffmpeg_g' failed make[1]: *** [ffmpeg_g] Error 247 make[1]: Leaving directory '/home/user/Desktop/webports/src/out/build/ffmpeg/build_pnacl' webports: Build failed: 'ffmpeg' [pnacl/release] Makefile:89: recipe for target 'ffmpeg' failed make: *** [ffmpeg] Error 1