Recherche avancée

Médias (91)

Autres articles (68)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (7097)

  • LibVLC DXVA2 Windows C++ Hardware Acceleration

    15 novembre 2016, par Sergiu Vlad

    I want to decode a h264 RTSP stream using DXVA2 Accelerated decoder. In VLC it does work but in my code have the following output :

    avcodec generic warning: threaded frame decoding is not compatible with DXVA2, disabled
    avcodec generic debug: available hardware decoder output format 61 (dxva2_vld)
    avcodec generic debug: available hardware decoder output format 128 (d3d11va_vld)
    avcodec generic debug: available software decoder output format 12 (yuvj420p)
    core generic debug: looking for hw decoder module matching "any": 1 candidates
    core generic debug: no hw decoder modules matched

    Is this a problem with NV12 conversion ? Is there a way to force DXVA2 ?

    Thanks

    CODE :

       #include
    #include
    #include
    #include
    #include
    #include <iostream>

    #include
    #include <ctime>
    #include <vlc></vlc>vlc.h>

    // RTSP address
    const char* rtspAddress = "rtsp://admin:admin@192.168.0.245/live_st1";
    // Video resolution WxH
    cv::Size rtspRes(1920, 1080);

    struct VideoDataStruct
    {
       int param;
    };

    int done = 0;
    libvlc_media_player_t *mp;
    unsigned int videoBufferSize = 0;
    uint8_t *videoBuffer = 0;

    void cbVideoPrerender(void *p_video_data, uint8_t **pp_pixel_buffer, int size)
    {
       if (size > videoBufferSize || !videoBuffer)
       {
           printf("Reallocate raw video buffer %d bytes\n", size);
           free(videoBuffer);
           videoBuffer = (uint8_t *)malloc(size);
           videoBufferSize = size;
       }

       // videoBuffer = (uint8_t *)malloc(size);
       *pp_pixel_buffer = videoBuffer;
    }
    void cbVideoPostrender(void *p_video_data, uint8_t *p_pixel_buffer, int width, int height, int pixel_pitch, int size, int64_t pts)
    {
       // Unlocking
       //CloseHandle(hMutex);

    }

    //static void handleEvent(const libvlc_event_t* pEvt, void* pUserData)
    //{
    //    libvlc_time_t time;
    //    switch (pEvt->type)
    //    {
    //    case libvlc_MediaPlayerTimeChanged:
    //        time = libvlc_media_player_get_time(mp);
    //        printf("MediaPlayerTimeChanged %lld ms\n", (long long)time);
    //        break;
    //    case libvlc_MediaPlayerEndReached:
    //        printf("MediaPlayerEndReached\n");
    //        done = 1;
    //        break;
    //    default:
    //        printf("%s\n", libvlc_event_type_name(pEvt->type));
    //    }
    //}

    clock_t startTime[8];
    int framesReceivedThisSecond[8];

    int main()
    {


       // VLC pointers
       libvlc_instance_t *inst;
       libvlc_media_t *m;
       void *pUserData = 0;

       VideoDataStruct dataStruct;

       // VLC options
       char smem_options[1000];

       // RV24
       sprintf(smem_options
               , "#transcode{vcodec=RV24}:smem{"
                 "video-prerender-callback=%lld,"
                 "video-postrender-callback=%lld,"
                 "video-data=%lld,"
                 "no-time-sync},"
               , (long long int)(intptr_t)(void*)&amp;cbVideoPrerender
               , (long long int)(intptr_t)(void*)&amp;cbVideoPostrender
               , (long long int)(intptr_t)(void*)&amp;dataStruct
               );

       const char * const vlc_args[] = {
           "-I", "dummy",            // Don't use any interface
           "--ignore-config",        // Don't use VLC's config
           "--extraintf=logger",     // Log anything
           "--verbose=4",            // Be verbose
           //        "--ffmpeg-hw",
           //        "-vvv",
           "--ffmpeg-hw",
           "--avcodec-hw=any",
           "--sout", smem_options    // Stream to memory

       };

       // Launch VLC
       inst = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);

       // Create a new item
       m = libvlc_media_new_location(inst, rtspAddress);



       // Create a media player playing environement
       mp = libvlc_media_player_new_from_media(m);

       //    libvlc_event_manager_t* eventManager = libvlc_media_player_event_manager(mp);
       //    libvlc_event_attach(eventManager, libvlc_MediaPlayerTimeChanged, handleEvent, pUserData);
       //    libvlc_event_attach(eventManager, libvlc_MediaPlayerEndReached, handleEvent, pUserData);
       //    libvlc_event_attach(eventManager, libvlc_MediaPlayerPositionChanged, handleEvent, pUserData);

       //libvlc_video_set_format(mp, "RV24", 240, 320, 240 * 3 );

       // play the media_player
       libvlc_media_player_play(mp);


       // Create a window for displaying the video
       std::string winName("Demo Video");
       cv::namedWindow(winName, cv::WINDOW_AUTOSIZE);

       cv::Mat frame;
       int key = 0;

       // Endless loop, press Esc to quit
       while (key != 27)
       {

           // Check for invalid input
           if (videoBuffer)
           {
               // CV_8UC3 = 8 bits, 3 chanels
               frame = cv::Mat(rtspRes, CV_8UC3, videoBuffer);
           }


           if (frame.rows == 0 || frame.cols == 0)
               continue;

           int stream_number=0;
           framesReceivedThisSecond[stream_number]++;
           long    duration = ( std::clock() - startTime[stream_number] );
           if(duration>1000)
           {
               std::cout&lt;&lt;"\n"&lt;&lt;"FPS "&lt;code></ctime></iostream>

    FULL LOG :

    core libvlc debug: Copyright © 1996-2016 the VideoLAN team
    core libvlc debug: revision 2.2.3-37-g888b7e89
    core libvlc debug: configured with ../extras/package/win32/../../../configure  '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=i686-w64-mingw32' '--build=x86_64-pc-linux-gnu' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=i686-w64-mingw32' 'PKG_CONFIG_PATH=/opt/intel/opencl:' 'PKG_CONFIG_LIBDIR=/home/svlad/DEV/vlc/contrib/i686-w64-mingw32/lib/pkgconfig'
    core libvlc debug: using multimedia timers as clock source
    core libvlc debug:  min period: 1 ms, max period: 1000000 ms
    core libvlc debug: searching plug-in modules
    core libvlc debug: loading plugins cache file C:\DEV\VLCStreamProcessor\build-untitled-Desktop_Qt_5_5_1_MSVC2013_32bit-Debug\debug\plugins\plugins.dat
    core libvlc debug: recursively browsing `C:\DEV\VLCStreamProcessor\build-untitled-Desktop_Qt_5_5_1_MSVC2013_32bit-Debug\debug\plugins'
    core libvlc debug: saving plugins cache C:\DEV\VLCStreamProcessor\build-untitled-Desktop_Qt_5_5_1_MSVC2013_32bit-Debug\debug\plugins\plugins.dat
    core libvlc debug: plug-ins loaded: 418 modules
    core libvlc debug: translation test: code is "C"
    core libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU
    core playlist debug: creating audio output
    core audio output debug: looking for audio output module matching "any": 6 candidates
    directsound audio output debug: found 2 devices
    core audio output debug: using audio output module "directsound"
    core playlist debug: keeping audio output
    core interface debug: looking for interface module matching "logger,none": 16 candidates
    logger interface: VLC media player - 2.2.4 Weatherwax
    logger interface: Copyright © 1996-2016 the VideoLAN team
    logger interface:
    Warning: if you cannot access the GUI anymore, open a command-line window, go to the directory where you installed VLC and run "vlc -I qt"
    logger interface: using logger.
    logger interface warning: no log filename provided, using `vlc-log.txt'
    logger interface debug: opening logfile `vlc-log.txt'
    core libvlc debug: VLC media player - 2.2.4 Weatherwax
    core libvlc debug: Copyright © 1996-2016 the VideoLAN team
    core libvlc debug: revision 2.2.3-37-g888b7e89
    core libvlc debug: configured with ../extras/package/win32/../../../configure  '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=i686-w64-mingw32' '--build=x86_64-pc-linux-gnu' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=i686-w64-mingw32' 'PKG_CONFIG_PATH=/opt/intel/opencl:' 'PKG_CONFIG_LIBDIR=/home/svlad/DEV/vlc/contrib/i686-w64-mingw32/lib/pkgconfig'
    core interface debug: using interface module "logger"
    core generic debug: creating audio output
    core audio output debug: looking for audio output module matching "any": 6 candidates
    directsound audio output debug: found 2 devices
    core audio output debug: using audio output module "directsound"
    core generic debug: keeping audio output
    core input debug: Creating an input for 'rtsp://192.168.0.245/live_st1'
    core stream output debug: using sout chain=`transcode{vcodec=RV24}:smem{video-prerender-callback=15667245,video-postrender-callback=15667630,video-data=3471900,no-time-sync},'
    core stream output debug: stream=`smem'
    core stream out debug: looking for sout stream module matching "smem": 22 candidates
    core stream out debug: set config option: sout-smem-video-prerender-callback to 15667245
    core stream out debug: set config option: sout-smem-video-postrender-callback to 15667630
    core stream out debug: set config option: sout-smem-video-data to 3471900
    core stream out debug: set config option: sout-smem-time-sync to (null)
    core stream out debug: using sout stream module "stream_out_smem"
    core stream output debug: stream=`transcode'
    core stream out debug: looking for sout stream module matching "transcode": 22 candidates
    core stream out debug: set config option: sout-transcode-vcodec to RV24
    stream_out_transcode stream out debug: Checking video codec mapping for RV24 got RV24
    stream_out_transcode stream out debug: codec video=RV24 0x0 scaling: 0.000000 0kb/s
    core stream out debug: using sout stream module "stream_out_transcode"
    core input debug: using timeshift granularity of 50 MiB, in path 'C:\Users\BCDVideo\AppData\Local\Temp'
    core input debug: `rtsp://admin:admin@192.168.0.245/live_st1' gives access `rtsp' demux `' path `admin:admin@192.168.0.245/live_st1'
    core input debug: specified demux `any'
    core input debug: creating demux: access='rtsp' demux='any' location='admin:admin@192.168.0.245/live_st1' file='\\admin:admin@192.168.0.245\live_st1'
    core demux debug: looking for access_demux module matching "rtsp": 12 candidates
    live555 demux debug: version 2016.01.12
    live555 demux debug: RTP subsession 'video/H264'
    core input debug: selecting program id=0
    live555 demux debug: setup start: 0.000000 stop:0.000000
    live555 demux debug: We have a timeout of 60 seconds
    live555 demux debug: spawned timeout thread
    live555 demux debug: play start: 0.000000 stop:0.000000
    core demux debug: using access_demux module "live555"
    core decoder debug: looking for packetizer module matching "any": 23 candidates
    packetizer_h264 decoder debug: found NAL_SPS (sps_id=0)
    packetizer_h264 decoder debug: found NAL_PPS (pps_id=0 sps_id=0)
    core decoder debug: using packetizer module "packetizer_h264"
    core input debug: starting in sync mode
    core demux meta debug: looking for meta reader module matching "any": 2 candidates
    lua demux meta debug: Trying Lua scripts in C:\Users\BCDVideo\AppData\Roaming\vlc\lua\meta\reader
    lua demux meta debug: Trying Lua scripts in C:\DEV\VLCStreamProcessor\build-untitled-Desktop_Qt_5_5_1_MSVC2013_32bit-Debug\debug\lua\meta\reader
    core demux meta debug: no meta reader modules matched
    core input debug: `rtsp://admin:admin@192.168.0.245/live_st1' successfully opened
    core input debug: switching to async mode
    core input debug: Buffering 0%
    core input debug: Buffering 3%
    core input debug: Buffering 10%
    core stream output debug: adding a new sout input (sout_input:00c21c50)
    core input debug: Buffering 13%
    stream_out_transcode stream out debug: creating video transcoding from fcc=`h264' to fcc=`RV24'
    core input debug: Buffering 16%
    core generic debug: looking for decoder module matching "any": 43 candidates
    core input debug: Buffering 20%
    core input debug: Buffering 23%
    avcodec generic debug: CPU flags: 0x0107d3db
    core input debug: Buffering 30%
    avcodec generic debug: trying to use direct rendering
    core input debug: Buffering 33%
    avcodec generic debug: allowing 4 thread(s) for decoding
    core input debug: Buffering 36%
    avcodec generic warning: threaded frame decoding is not compatible with DXVA2, disabled
    core input debug: Buffering 40%
    avcodec generic debug: avcodec codec (H264 - MPEG-4 AVC (part 10)) started
    core input debug: Buffering 43%
    avcodec generic debug: using slice thread mode with 4 threads
    core input debug: Buffering 50%
    core generic debug: using decoder module "avcodec"
    core input debug: Buffering 53%
    core encoder debug: looking for encoder module matching "any": 20 candidates
    core input debug: Buffering 56%
    core input debug: Buffering 60%
    avcodec encoder debug: CPU flags: 0x0107d3db
    core input debug: Buffering 63%
    avcodec encoder debug: Time base for probing setted to 1/1000000
    core input debug: Buffering 70%
    avcodec encoder debug: Time base set to 1/1000000
    core input debug: Buffering 73%
    avcodec encoder debug: found encoder Raw video
    core input debug: Buffering 76%
    core encoder debug: using encoder module "avcodec"
    core input debug: Buffering 80%
    core encoder debug: removing module "avcodec"
    core input debug: Buffering 83%
    core input debug: Buffering 90%
    core input debug: Buffering 93%
    core input debug: Buffering 96%
    core input debug: Stream buffering done (1002 ms in 834 ms)
    core input debug: Decoder wait done in 0 ms
    avcodec generic debug: available hardware decoder output format 61 (dxva2_vld)
    avcodec generic debug: available hardware decoder output format 128 (d3d11va_vld)
    avcodec generic debug: available software decoder output format 12 (yuvj420p)
    core generic debug: looking for hw decoder module matching "any": 1 candidates
    core generic debug: no hw decoder modules matched
    avcodec generic warning: plane 0 not aligned
    avcodec generic warning: disabling direct rendering
    stream_out_transcode stream out debug: decoder aspect is 1.761468:1
    stream_out_transcode stream out debug: source pixel aspect is 0.990826:1
    stream_out_transcode stream out debug: scaled pixel aspect is 0.990826:1
    stream_out_transcode stream out debug: source 1920x1080, destination 1920x1080
    stream_out_transcode stream out debug: source fps 30/1, destination 30/1
    stream_out_transcode stream out: input interval 33333 (base 1)
    stream_out_transcode stream out: output interval 33333 (base 1)
    stream_out_transcode stream out debug: encoder aspect is 1920:1090
    core filter debug: looking for video filter2 module matching "any": 58 candidates
    swscale filter debug: 1920x1080 (1920x1090) chroma: J420 -> 1920x1080 (1920x1090) chroma: RV24 with scaling using Bicubic (good quality)
    core filter debug: using video filter2 module "swscale"
    core stream out debug: Filter 'Swscale' (0089a2cc) appended to chain
    stream_out_transcode stream out debug: destination (after video filters) 1920x1090
    core encoder debug: looking for encoder module matching "any": 20 candidates
    avcodec encoder debug: CPU flags: 0x0107d3db
    avcodec encoder debug: Time base for probing setted to 1/30
    avcodec encoder debug: Time base set to 1/30
    avcodec encoder debug: found encoder Raw video
    core encoder debug: using encoder module "avcodec"
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518755, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518756, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518757, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518758, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518759, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518760, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518761, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518762, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518763, last: 1518769)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518764, last: 1518769)
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518784, last: 1518795)
    live555 demux debug: tk->rtpSource->hasBeenSynchronizedUsingRTCP()
    core input error: ES_OUT_RESET_PCR called
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518785, last: 1518795)
    core input debug: Buffering 0%
    core input debug: Buffering 3%
    core input debug: Buffering 6%
    core input debug: Buffering 10%
    core input debug: Buffering 13%
    core input debug: Buffering 20%
    core input debug: Buffering 23%
    core input debug: Buffering 26%
    core input debug: Buffering 30%
    core input debug: Buffering 33%
    core input debug: Buffering 40%
    core input debug: Buffering 43%
    core input debug: Buffering 46%
    core input debug: Buffering 50%
    core input debug: Buffering 53%
    core input debug: Buffering 60%
    core input debug: Buffering 63%
    core input debug: Buffering 66%
    core input debug: Buffering 70%
    core input debug: Buffering 73%
    core input debug: Buffering 80%
    core input debug: Buffering 83%
    core input debug: Buffering 86%
    core input debug: Buffering 90%
    core input debug: Buffering 93%
    core input debug: Stream buffering done (1002 ms in 817 ms)
    core input debug: Decoder wait done in 0 ms
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518834, last: 1518837)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518835, last: 1518837)
    avcodec encoder warning: almost fed libavcodec with a frame in the past (current: 1518836, last: 1518837)
    avcodec encoder warning: almost fed libavcodec with two frames with the same PTS (1518837)
    stream_out_transcode stream out warning: Reseting video sync
    stream_out_transcode stream out warning: Reseting video sync
  • Crash at sws_scale when converting AVFrame to RGB32

    1er mars 2017, par WLGfx

    Crashing at sws_scale when converting an AVPicture

    At first I was using sws_scale to actually scale the frames up but the cpu overhead was too high, so I decided to just convert the frames and adjust the QImage size instead. Before it was working and I was getting the video displaying when rendered, but now it crashes at sws_scale.

    This is written in Qt for Android and using FFMpeg 3.1.4.

    Also, is there another way around not using the deprecated functions ?

    Does anybody know why I am getting the crash at sws_scale ?

    The class for the VideoFrameCopy

    class VideoFrameCopy {
    public:
       VideoFrameCopy() {}
       VideoFrameCopy(AVFrame *frame) { copyAVFrame(frame); }
       ~VideoFrameCopy();
       void copyAVFrame(AVFrame *frame); // copy essential data from AVFrame

       AVPicture picture;

       int64_t pkt_pts = -1; // show it hasn't been initialised
       int64_t best_pts;
       int interlaced_frame;
       int width = 0, height = 0;
       int format = -1;
    };

    The code that converts the frame to RGBA8888 QImage

    if (frame) {

       if (image->width() != vid_ctx->width || image->height() != vid_ctx->height) {
           QSize old_size(image->size());

           // block until renderer has finished with it

           while (parent->buffer_ready) {
               QThread::yieldCurrentThread();
           }

           delete image;

           image = new QImage(vid_ctx->width, vid_ctx->height, QImage::Format_RGBA8888);
           parent->image = image;

           if (scale_context) sws_freeContext(scale_context);
           scale_context = nullptr;

           qDebug() &lt;&lt; "Video image size" &lt;&lt; image->size() &lt;&lt; "old" &lt;&lt; old_size;
       }

       // the src width and height may need to change to use the context info instead

       if (!scale_context) { // create the scale context
           int src_width = vid_ctx->width;
           int src_height = vid_ctx->height;
           AVPixelFormat src_format = vid_ctx->pix_fmt;//(AVPixelFormat)frame->format;

           int dst_width = vid_ctx->width;
           int dst_height = vid_ctx->height;
           AVPixelFormat dst_format = AV_PIX_FMT_RGBA;

           scale_context = sws_getContext(src_width, src_height, src_format,
                                          dst_width, dst_height, dst_format,
                                          SWS_FAST_BILINEAR, NULL, NULL, NULL);

           av_image_fill_linesizes(scale_linesizes, dst_format, vid_ctx->width);

           qDebug() &lt;&lt; "Created scale context" &lt;&lt; scale_context;
       }

       if (scale_context) { // valid
           scale_data[0] = image->bits();

           sws_scale(scale_context,
                     frame->picture.data, // deprecated
                     frame->picture.linesize, // deprecated
                     0, image->height(),
                     scale_data,
                     scale_linesizes);

           qDebug() &lt;&lt; "Frame converted";
       }

       //av_frame_unref(frame);

       //vid_frames_mutex.lock();
       //if (quit) av_frame_free(&amp;frame);
       if (quit) delete frame;
       else vid_frames_unused.push_back(frame);
       //vid_frames_mutex.unlock();

       //qDebug() &lt;&lt; "got frame" &lt;&lt; clock_current_frame_last &lt;&lt; "clock" &lt;&lt; clock_current_time;
    }

    vid_frames_mutex.unlock();

    return frame != nullptr;

    Functions from the VideoFrameCopy class

    void VideoFrameCopy::copyAVFrame(AVFrame *frame) {
       if (pkt_pts != -1 &amp;&amp;
               (width != frame->width ||
                height != frame->height ||
                format != frame->format)
               ) { // picture changed?
           avpicture_free(&amp;picture); // deprecated
           pkt_pts = -1;
       }

       width = frame->width;
       height = frame->height;
       format = frame->format;
       interlaced_frame = frame->interlaced_frame;

       if (pkt_pts == -1) { // alloc picture
           if (avpicture_alloc(&amp;picture, (AVPixelFormat)format, width, height) &lt; 0) return; // deprecated
           int size = avpicture_get_size((AVPixelFormat)format, width, height); // deprecated
           uint8_t *picture_data = (uint8_t*)av_malloc(size);
           avpicture_fill(&amp;picture, picture_data, (AVPixelFormat)format, width, height); // deprecated

           qDebug() &lt;&lt; "New frame" &lt;&lt; width &lt;&lt; "x" &lt;&lt; height &lt;&lt; format;
       }

       pkt_pts = frame->pkt_pts;
       best_pts = av_frame_get_best_effort_timestamp(frame);

       av_picture_copy(&amp;picture, (AVPicture*)frame, (AVPixelFormat)format, width, height); // deprecated

       qDebug() &lt;&lt; "picture" &lt;&lt; picture.linesize[0] &lt;&lt; picture.linesize[1]; // deprecated
    }

    VideoFrameCopy::~VideoFrameCopy() {
       if (pkt_pts != -1) {
           /*if (picture.data) {
               av_free(picture.data);
               picture.data = nullptr;
           }*/
           avpicture_free(&amp;picture); // deprecated
       }
    }

    Sample output from the logcat

    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:659 (void VideoFrameCopy::copyAVFrame(AVFrame*)): New frame 640 x 358 0
    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:667 (void VideoFrameCopy::copyAVFrame(AVFrame*)): picture 640 320
    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:586 (bool FFMpegFile::getVideoFrame()): Video image size QSize(640, 358) old QSize(500, 320)
    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:659 (void VideoFrameCopy::copyAVFrame(AVFrame*)): New frame 640 x 358 0
    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:606 (bool FFMpegFile::getVideoFrame()): Created scale context 0x4bb49060
    D/libcwengage2.so(20157): ../cwengage2/ffmpegfile.cpp:667 (void VideoFrameCopy::copyAVFrame(AVFrame*)): picture 640 320
    F/libc    (20157): Fatal signal 7 (SIGBUS) at 0x4e065008 (code=1), thread 20335 (QThread)
    I/DEBUG   (  116): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    I/DEBUG   (  116): Build fingerprint: 'ODROID/odroidc/odroidc:4.4.2/KOT49H/odroidc-eng-s805_4.4.2_master-410:eng/test-keys'
    I/DEBUG   (  116): Revision: '10'
    I/DEBUG   (  116): pid: 20157, tid: 20335, name: QThread  >>> org.qtproject.example &lt;&lt;&lt;
    I/DEBUG   (  116): signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 4e065008
    I/DEBUG   (  116):     r0 00000280  r1 00000166  r2 4e065008  r3 00000a00
    I/DEBUG   (  116):     r4 4d9bd030  r5 00000280  r6 4d9f4f28  r7 00000140
    I/DEBUG   (  116):     r8 00000280  r9 00000010  sl 4da02ee8  fp 4e065a08
    I/DEBUG   (  116):     ip 4d9bd2a0  sp 4c1948f8  lr 4a8f1d2c  pc 4a8f4dc0  cpsr 280f0010
    I/DEBUG   (  116):     d0  004a004a004a004a  d1  0081ffccffe70066
    I/DEBUG   (  116):     d2  004a004a004a004a  d3  0000000000000000
    I/DEBUG   (  116):     d4  0000000000000000  d5  0000000000000000
    I/DEBUG   (  116):     d6  0000000001010101  d7  0000000001010101
    I/DEBUG   (  116):     d8  0000000001010101  d9  ffffffffffffffff
    I/DEBUG   (  116):     d10 0000000000000000  d11 0000000000000000
    I/DEBUG   (  116):     d12 0000000000000000  d13 ffffffffffffffff
    I/DEBUG   (  116):     d14 004a004a004a004a  d15 004a004a004a004a
    I/DEBUG   (  116):     d16 0000000000000000  d17 0000000000000000
    I/DEBUG   (  116):     d18 0000000000000000  d19 0000000000000000
    I/DEBUG   (  116):     d20 0000000000000000  d21 0000000000000000
    I/DEBUG   (  116):     d22 0000000000000000  d23 0000000000000000
    I/DEBUG   (  116):     d24 0000000000000000  d25 0000000000000000
    I/DEBUG   (  116):     d26 0000000000000000  d27 0000000000000000
    I/DEBUG   (  116):     d28 004a004a004a004a  d29 0000000000000000
    I/DEBUG   (  116):     d30 0000000000000000  d31 0000000000000000
    I/DEBUG   (  116):     scr 20000010
    I/DEBUG   (  116):
    I/DEBUG   (  116): backtrace:
    I/DEBUG   (  116):     #00  pc 0000edc0  /data/app-lib/org.qtproject.example-1/libswscale-4.so
    I/DEBUG   (  116):     #01  pc 0000bd28  /data/app-lib/org.qtproject.example-1/libswscale-4.so
    I/DEBUG   (  116):
    I/DEBUG   (  116): stack:
    I/DEBUG   (  116):          4c1948b8  0000004b  
    I/DEBUG   (  116):          4c1948bc  4bb2d270  
    I/DEBUG   (  116):          4c1948c0  0000013c  
    I/DEBUG   (  116):          4c1948c4  4011edbc  /system/lib/libc.so (dlmalloc+480)
    I/DEBUG   (  116):          4c1948c8  4c19494a  [stack:20335]
    I/DEBUG   (  116):          4c1948cc  4015e384  
    I/DEBUG   (  116):          4c1948d0  00000010  
    I/DEBUG   (  116):          4c1948d4  489033ef  /data/app-lib/org.qtproject.example-1/libQt5Core.so
    I/DEBUG   (  116):          4c1948d8  00001000  
    I/DEBUG   (  116):          4c1948dc  00000000  
    I/DEBUG   (  116):          4c1948e0  4bb2d470  
    I/DEBUG   (  116):          4c1948e4  4bb2d478  
    I/DEBUG   (  116):          4c1948e8  4bb2d478  
    I/DEBUG   (  116):          4c1948ec  4bb2d470  
    I/DEBUG   (  116):          4c1948f0  00000002  
    I/DEBUG   (  116):          4c1948f4  4012109c  /system/lib/libc.so (dlfree+996)
    I/DEBUG   (  116):     #00  4c1948f8  11111111  
    I/DEBUG   (  116):          ........  ........
    I/DEBUG   (  116):     #01  4c1948f8  11111111  
    I/DEBUG   (  116):          4c1948fc  3fa11111  
    I/DEBUG   (  116):          4c194900  40000000  
    I/DEBUG   (  116):          4c194904  40640d79  /system/lib/libskia.so
    I/DEBUG   (  116):          4c194908  00000000  
    I/DEBUG   (  116):          4c19490c  3ff00000  
    I/DEBUG   (  116):          4c194910  00000000  
    I/DEBUG   (  116):          4c194914  3ff00000  
    I/DEBUG   (  116):          4c194918  00000000  
    I/DEBUG   (  116):          4c19491c  3ff00000  
    I/DEBUG   (  116):          4c194920  00000000  
    I/DEBUG   (  116):          4c194924  3f800000  
    I/DEBUG   (  116):          4c194928  00000000  
    I/DEBUG   (  116):          4c19492c  00000000  
    I/DEBUG   (  116):          4c194930  00000000  
    I/DEBUG   (  116):          4c194934  00000000  
    I/DEBUG   (  116):
    I/DEBUG   (  116): memory near r2:
    I/DEBUG   (  116):     4e064fe8 00000000 00000000 00000000 00000007  

    ...

    I/DEBUG   (  116): memory map around fault addr 4e065008:
    I/DEBUG   (  116):     4dd15000-4df15000 rw- /dev/mali
    I/DEBUG   (  116):     4df15000-4e199000 rw-
    I/DEBUG   (  116):     4e676000-4e876000 rw- /dev/mali
    I/BootReceiver(  479): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
    W/ActivityManager(  479):   Force finishing activity org.qtproject.example/org.qtproject.qt5.android.bindings.QtActivity
    I/WindowState(  479): WIN DEATH: Window{64cf3a40 u0 org.qtproject.example/org.qtproject.qt5.android.bindings.QtActivity}
    I/WindowState(  479): WIN DEATH: Window{64d0f6e0 u0 SurfaceView}
    I/UsageStats(  479): No package stats for pkg:org.qtproject.example
    I/art     (  118): Process 20157 terminated by signal (7)
    W/ActivityManager(  479): Exception thrown during pause
    W/ActivityManager(  479): android.os.DeadObjectException
    W/ActivityManager(  479):   at android.os.BinderProxy.transact(Native Method)
    W/ActivityManager(  479):   at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:660)
    W/ActivityManager(  479):   at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:778)
    W/ActivityManager(  479):   at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2614)
    W/ActivityManager(  479):   at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2488)
    W/ActivityManager(  479):   at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2196)
    W/ActivityManager(  479):   at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:9705)
    W/ActivityManager(  479):   at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:9598)
    W/ActivityManager(  479):   at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:10243)
    W/ActivityManager(  479):   at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:9794)
    W/ActivityManager(  479):   at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
    D/ActivityManager(  479): resumeClassName is com.android.launcher2.Launcher
    D/ActivityManager(  479): resumePackageName is com.android.launcher
    I/ActivityManager(  479): Process org.qtproject.example (pid 20157) has died.
    D/ActivityManager(  479): send app_CRASH broadcast, packageName:org.qtproject.example

    Much appreciated if anyone can help...

  • watermark image get rotated on video using ffmpeg- android

    24 avril 2017, par Pratik Deogade

    I am trying to add water mark on my video in android, i am successfull in adding it but the problem is water image get rotated by 90 degree clock wise

    here is my command

    String[] complexCommand = "ffmpeg","-y" ,"-i", "/sdcard/Vid.mp4","-strict","experimental", "-vf", "movie=/sdcard/watermarka.png [watermark] ; [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s", "320x2400","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050", "/sdcard/out.mp4" ;

    the output i am getting is :
    enter image description here