Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (2)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (2050)

  • How to start ffprobe with Windows PowerShell

    7 mars 2014, par sebastian

    I am using Zeranoes FFmpeg Builds for Windows and I can start the ff-prompt without installing anything. But how do I start ff-prompt.bat with Windows PowerShell ? I have tried a few things like Invoke-Expression or changing the $env:Path but nothing seems to work, because all I get is the message

    "C :\Users\Administrator>ECHO OFF

    bin\ffmpeg.exe could not be found."

    Is it even possible to start ff-prompt with PowerShell ? Every suggestion / solution is more than welcome.

    My goal is to have a solution that works like this here :
    http://spreadys.wordpress.com/2012/12/03/ffprobe-and-windows-powershell/

    but I want to do that automatically for all my clips, thats why I need to start ffprobe with powershell.


    ECHO OFF
    REM FF Prompt 1.1
    REM Open a command prompt to run ffmpeg/ffplay/ffprobe
    REM Copyright (C) 2013  Kyle Schwarz

    TITLE FF Prompt

    IF NOT EXIST bin\ffmpeg.exe (
     CLS
     ECHO bin\ffmpeg.exe could not be found.
     GOTO:error
    )

    CD bin || GOTO:error
    PROMPT $G
    CLS
    ffmpeg -version
    SET PATH=%CD%;%PATH%
    ECHO.
    ECHO For help run: ffmpeg -h
    ECHO For formats run: ffmpeg -formats ^| more
    ECHO For codecs run: ffmpeg -codecs ^| more
    ECHO.
    ECHO Current directory is now: "%CD%"
    ECHO The bin directory has been added to PATH
    ECHO.

    CMD /F:ON /Q /K
    GOTO:EOF

    :error
     ECHO.
     ECHO Press any key to exit.
     PAUSE >nul
     GOTO:EOF

    Okay I tried something a little bit different this time :

    $env:Path = ';C:\Users\Administrator\bin\'
    $title = "A_Day_for_Cake_and_Accidents"
    Start-Process ff-prompt.bat -ArgumentList "ffprobe -show_streams -select_streams v -print_format xml -count_frames C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\$title.mov > C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\totalframes.xml"

    This creates a file called "totalframes.xml" but without the needed information, the only thing I get is :

    C :\Users\Administrator>ECHO OFF
    ffmpeg version N-60959-g669043d
    built on Feb 27 2014 22:01:58 with gcc 4.8.2 (GCC)
    configuration : —enable-gpl —enable-version3 —disable-w32threads —enable-avisynth —enable-bzlib —enable-fontconfig —enable-frei0r —enable-gnutls —enable-iconv —enable-libass —enable-libbluray —enable-libcaca —enable-libfreetype —enable-libgsm —enable-libilbc —enable-libmodplug —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-librtmp —enable-libschroedinger —enable-libsoxr —enable-libspeex —enable-libtheora —enable-libtwolame —enable-libvidstab —enable-libvo-aacenc —enable-libvo-amrwbenc —enable-libvorbis —enable-libvpx —enable-libwavpack —enable-libx264 —enable-libx265 —enable-libxavs —enable-libxvid —enable-zlib
    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
    libswscale 2. 5.101 / 2. 5.101
    libswresample 0. 18.100 / 0. 18.100
    libpostproc 52. 3.100 / 52. 3.100
    For help run : ffmpeg -h
    For formats run : ffmpeg -formats | more
    For codecs run : ffmpeg -codecs | more
    Current directory is now : "C :\Users\Administrator\bin"
    The bin directory has been added to PATH

    So basically the console pops up, writes this standard text and does not use my commands which I stated in -Argument-List . I do not have a clue why it is ignoring most of my commands, except for writing everything in a XML file.

  • Apple HLS with ffmpeg and mediastreamsegmenter and vlc

    6 août 2015, par user3387312

    I’m trying to stream using a ffmpeg stream from a windows box. Here is the command I’m running on the windows box

    ffmpeg -f dshow -i audio=”Wave In 2 32130101 (Orban Optim” -acodec libmp3lame -ab 64k -f mpegts udp ://172.30.16.181:2222 ?pkt_size=188 ?buffer_size=128000

    This part works and I’m able to listen to it on my mac via VLC and I’m streaming it out from VLC to port 20103

    but when I use mediasegmenter
    mediastreamsegmenter -s 3 -f /Users/vickkrish/ 127.0.0.1:2222

    This is what happens
    Mar 6 2014 04:11:02.926 : audio pid set at 44
    Mar 6 2014 04:11:03.165 : audio pid change to 44
    Mar 6 2014 04:11:03.328 : audio pid change to 44
    Mar 6 2014 04:11:03.583 : audio pid change to 44
    Mar 6 2014 04:11:03.745 : audio pid change to 44
    Mar 6 2014 04:11:03.989 : audio pid change to 44
    Mar 6 2014 04:11:04.151 : audio pid change to 44
    Mar 6 2014 04:11:04.316 : audio pid change to 44
    Mar 6 2014 04:11:04.492 : audio pid change to 44
    Mar 6 2014 04:11:04.740 : audio pid change to 44
    Mar 6 2014 04:11:04.887 : audio pid change to 44
    Mar 6 2014 04:11:05.175 : audio pid change to 44
    Mar 6 2014 04:11:05.338 : audio pid change to 44
    Mar 6 2014 04:11:05.582 : audio pid change to 44

    and no .ts files are created.

  • Stuttering rendering using ffmpeg and sdl2

    22 décembre 2020, par Wiesen_Walle

    With the following Code I get a stuttering rendering of the movie file. Interesstingly, when dumping information with ffmpeg it says it has 25 fps and a duration of 00:01:32.90 ; however when counting the frames and time it runs by myself it gives a time of about 252 seconds, I guess the code receiving the frames and sending the package (int cap(vid v)) draws the same frame multiple of times. But I cannot see what's wrong ?

    


    //PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib64/pkgconfig/   --> add path to PKF_Config search path&#xA;//export PKG_CONFIG_PATH --> export PKG_Config search path to become visible for gcc&#xA;//gcc ffmpeg_capture_fl.c -Wall -pedantic -fPIC `pkg-config --cflags --libs libavdevice libavformat libavcodec libavutil libavdevice libavfilter libswscale libswresample sdl2`&#xA;&#xA;&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include &#xA;#include &#xA;#include <libavutil></libavutil>rational.h>&#xA;#include <sys></sys>time.h>&#xA;#include &#xA;&#xA;&#xA;typedef struct vid{&#xA;AVFormatContext *inc;&#xA;AVInputFormat *iformat;&#xA;AVCodecContext  *pCodecCtx;&#xA;AVCodec         *pCodec;&#xA;AVFrame         *pFrame;&#xA;int videoStream;} vid;&#xA;&#xA;typedef struct sws{&#xA;struct SwsContext *ctx;&#xA;uint8_t **buffer;&#xA;int *linesize;&#xA;} sws;&#xA;&#xA;&#xA;vid cap_init_fl(char *fl);&#xA;int cap(vid v);&#xA;void cap_close(vid v);&#xA;&#xA;sws init_swsctx(int width, int height, enum AVPixelFormat pix_fmt, int new_width, int new_height, enum AVPixelFormat new_pxf);&#xA;void conv_pxlformat(sws scale, uint8_t **src_data, int *src_linesize, int height);&#xA;void free_sws(sws inp);&#xA;&#xA;#include <sdl2></sdl2>SDL.h>&#xA;&#xA;typedef struct sdl_window{&#xA;    SDL_Window *window;&#xA;    SDL_Renderer *renderer;&#xA;    SDL_Texture *texture;&#xA;    SDL_Event *event;&#xA;    int width;&#xA;    int height;&#xA;    int pitch;&#xA;    uint32_t sdl_pxl_frmt;&#xA;    }sdl_window;&#xA;&#xA;sdl_window init_windowBGR24_ffmpg(int width, int height);&#xA;int render_on_texture_update(sdl_window wow, uint8_t *data);&#xA;void close_window(sdl_window wow);&#xA;&#xA;&#xA;vid cap_init_fl(char *fl){&#xA;    vid v = {NULL, NULL, NULL, NULL, NULL, -1};&#xA;    int i;&#xA;    &#xA;    av_register_all();&#xA;    avdevice_register_all();&#xA;&#xA;    if( 0 > avformat_open_input( &amp;(v.inc), fl , v.iformat, NULL)) {&#xA;        printf("Input device could not been opened\n");&#xA;        cap_close(v);&#xA;        exit(1);&#xA;        }&#xA;&#xA;    if(avformat_find_stream_info(v.inc, NULL)&lt;0){&#xA;        printf("Stream information could not been found.\n");&#xA;        cap_close(v);&#xA;        exit(2);&#xA;    }&#xA;&#xA;    // Dump information about file onto standard error&#xA;    av_dump_format(v.inc, 0, fl, 0);&#xA;&#xA;    // Find the first video stream&#xA;    v.videoStream=-1;&#xA;    for(i=0; inb_streams; i&#x2B;&#x2B;){&#xA;      if(v.inc->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {&#xA;        v.videoStream=i;&#xA;        break;&#xA;      }}&#xA;&#xA;    if(v.videoStream==-1){&#xA;        printf("Could not find video stream.\n");&#xA;        cap_close(v);&#xA;        exit(3);&#xA;        }&#xA;&#xA;    // Find the decoder for the video stream&#xA;    v.pCodec=avcodec_find_decoder(v.inc->streams[v.videoStream]->codecpar->codec_id);&#xA;        if(v.pCodec==NULL) {&#xA;          printf("Unsupported codec!\n");&#xA;        cap_close(v);&#xA;        exit(4);&#xA;           // Codec not found&#xA;        }&#xA;&#xA;    &#xA;&#xA;    // Get a pointer to the codec context for the video stream&#xA;    &#xA;    if((v.pCodecCtx=avcodec_alloc_context3(NULL)) == NULL){&#xA;        printf("Could not allocate codec context\n");&#xA;        cap_close(v);&#xA;        exit(10);}&#xA;&#xA;    avcodec_parameters_to_context (v.pCodecCtx, v.inc->streams[v.videoStream]->codecpar);       &#xA;    &#xA;    // Open codec&#xA;    if(avcodec_open2(v.pCodecCtx, v.pCodec, NULL)&lt;0){&#xA;        printf("Could not open codec");&#xA;        cap_close(v);&#xA;        exit(5);&#xA;        }&#xA;        &#xA;    &#xA;    // Allocate video frame&#xA;    v.pFrame=av_frame_alloc();&#xA;    if(v.pFrame==NULL){&#xA;        printf("Could not allocate AVframe");&#xA;        cap_close(v);&#xA;        exit(6);}&#xA;&#xA;    &#xA;    return v;&#xA;}&#xA;&#xA;&#xA;&#xA;int cap(vid v){&#xA;    int errorCodeRF, errorCodeSP, errorCodeRecFR;&#xA;    AVPacket pkt;&#xA;        &#xA;    if((errorCodeRF = av_read_frame(v.inc, &amp;pkt))  >= 0){&#xA;        &#xA;        if (pkt.stream_index == v.videoStream) {&#xA;            &#xA;            errorCodeSP = avcodec_send_packet(v.pCodecCtx, &amp;pkt);&#xA;            &#xA;            if (errorCodeSP >= 0 || errorCodeSP == AVERROR(EAGAIN)){&#xA;                &#xA;                errorCodeRecFR = avcodec_receive_frame(v.pCodecCtx, v.pFrame);&#xA;                &#xA;                if (errorCodeRecFR &lt; 0){ &#xA;                    av_packet_unref(&amp;pkt);&#xA;                    return errorCodeRecFR;&#xA;                    }&#xA;                else{&#xA;                    av_packet_unref(&amp;pkt);&#xA;                    return 0;&#xA;                    }&#xA;                &#xA;                }&#xA;            else{&#xA;                 av_packet_unref(&amp;pkt);&#xA;                 return errorCodeSP;}&#xA;                &#xA;        }}&#xA;                &#xA;    else{&#xA;        return errorCodeRF;}&#xA;        return 1;&#xA;        }&#xA;    &#xA;    &#xA;&#xA;void cap_close(vid v){&#xA;    if(v.pFrame != NULL) av_free(v.pFrame);&#xA;    avcodec_close(v.pCodecCtx);&#xA;    avformat_close_input(&amp;(v.inc));&#xA;    if(v.inc != NULL) avformat_free_context(v.inc);&#xA;    &#xA;    v.inc = NULL;&#xA;    v.iformat = NULL;&#xA;    v.pCodecCtx = NULL;&#xA;    v.pCodec = NULL;&#xA;    v.pFrame = NULL;&#xA;    v.videoStream=-1;}&#xA;&#xA;&#xA;&#xA;sws init_swsctx(int width, int height, enum AVPixelFormat pix_fmt, int new_width, int new_height, enum AVPixelFormat new_pxf){&#xA;&#xA;int nwidth, nheight;&#xA;sws scale;&#xA;&#xA;scale.buffer = (uint8_t **) malloc(4 * sizeof(uint8_t *));&#xA;scale.linesize = (int *) malloc(4 * sizeof(int));&#xA;&#xA;&#xA;nwidth = (new_width &lt;= 0) ?  width : new_width;&#xA;nheight = (new_height &lt;= 0) ?  height : new_height;&#xA;&#xA;av_image_alloc(scale.buffer, scale.linesize, nwidth, nheight, new_pxf, 1);&#xA;scale.ctx = sws_getContext(width, height, pix_fmt, nwidth, nheight, new_pxf, SWS_BILINEAR, NULL, NULL, NULL);&#xA;&#xA;if(scale.ctx==NULL){&#xA;    printf("Could not allocate SWS-Context\n");&#xA;    av_freep(&amp;(scale.buffer)[0]);&#xA;    free(scale.buffer);&#xA;    free(scale.linesize);&#xA;    exit(12);&#xA;    }&#xA;            &#xA;return scale;}&#xA;&#xA;&#xA;void conv_pxlformat(sws scale, uint8_t **src_data, int *src_linesize, int height){  &#xA;    sws_scale(scale.ctx, (const uint8_t **) src_data, src_linesize, 0, height, scale.buffer, scale.linesize);&#xA;    }&#xA;&#xA;&#xA;void free_sws(sws inp){&#xA;    av_freep(&amp;(inp.buffer)[0]);&#xA;    free(inp.buffer);&#xA;    free(inp.linesize); &#xA;}&#xA;&#xA;&#xA;sdl_window init_windowBGR24_ffmpg(int width, int height){&#xA;&#xA; sdl_window wow;&#xA;    &#xA; if (SDL_Init(SDL_INIT_VIDEO) &lt; 0) {&#xA;    printf("Couldn&#x27;t initialize SDL in function: create_sdl_window(...)\n");&#xA;    exit(7);}&#xA;    &#xA; wow.window = SDL_CreateWindow("SDL_CreateTexture",&#xA;                        SDL_WINDOWPOS_UNDEFINED,&#xA;                        SDL_WINDOWPOS_UNDEFINED,&#xA;                        width, height,&#xA;                        SDL_WINDOW_RESIZABLE);&#xA;&#xA; wow.renderer = SDL_CreateRenderer(wow.window, -1, SDL_RENDERER_ACCELERATED);&#xA; wow.texture = SDL_CreateTexture(wow.renderer, SDL_PIXELFORMAT_BGR24, SDL_TEXTUREACCESS_STREAMING, width, height);&#xA; wow.width = width;&#xA; wow.height = height;&#xA; wow.pitch = width * 3;  //only true for 3 byte / 24bit packed formats like bgr24&#xA; wow.sdl_pxl_frmt = SDL_PIXELFORMAT_BGR24;&#xA; SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); &#xA; SDL_SetHint(SDL_HINT_RENDER_VSYNC, "enable"); &#xA; SDL_RenderSetLogicalSize(wow.renderer, wow.width, wow.height);&#xA; return wow;&#xA;}&#xA;&#xA;&#xA;int render_on_texture_update(sdl_window wow, uint8_t *data){&#xA;    &#xA;    if (SDL_UpdateTexture(wow.texture, NULL, data, wow.pitch)&lt; 0){&#xA;        printf("SDL_render_on_texture_update_failed: %s\n", SDL_GetError());&#xA;        return -1;&#xA;        }&#xA;    SDL_RenderClear(wow.renderer);&#xA;    SDL_RenderCopy(wow.renderer, wow.texture, NULL, NULL);&#xA;    SDL_RenderPresent(wow.renderer);&#xA;&#xA;    return 0; &#xA;}&#xA;&#xA;&#xA;void close_window(sdl_window wow){&#xA;    SDL_DestroyRenderer(wow.renderer);&#xA;    SDL_Quit();&#xA;}&#xA;&#xA;&#xA;&#xA;&#xA;int main(){&#xA;    int n, vid_error;&#xA;    long int time_per_frame_usec, duration_usec;&#xA;    vid v;&#xA;    sdl_window wow;&#xA;    struct timeval tval_start, tval_start1, tval_end, tval_duration;&#xA;    sws scale;&#xA;    SDL_Event event;&#xA;   &#xA;    vid_error = AVERROR(EAGAIN);&#xA;    v = cap_init_fl("mw_maze_test.mp4"); &#xA;    &#xA;    while(vid_error == AVERROR(EAGAIN)){&#xA;        vid_error =cap(v);}&#xA;        &#xA;    if(vid_error &lt; 0){&#xA;        printf("Could not read from Capture\n");&#xA;        cap_close(v);&#xA;        return 0;&#xA;        }&#xA;&#xA;    wow = init_windowBGR24_ffmpg((v.pCodecCtx)->width, (v.pCodecCtx)->height);&#xA;    scale = init_swsctx((v.pCodecCtx)->width, (v.pCodecCtx)->height, (v.pCodecCtx)->pix_fmt, 0, 0, AV_PIX_FMT_BGR24);&#xA;        &#xA;    time_per_frame_usec =  ((long int)((v.inc)->streams[v.videoStream]->avg_frame_rate.den) *  1000000 / (long int) ((v.inc)->streams[v.videoStream]->avg_frame_rate.num));&#xA;    &#xA;    printf("Time per frame: %ld\n", time_per_frame_usec);&#xA;    n = 0;&#xA;    &#xA;    gettimeofday(&amp;tval_start, NULL);&#xA;    gettimeofday(&amp;tval_start1, NULL);&#xA;    &#xA;    while ((vid_error =cap(v)) >= 0) {&#xA;                &#xA;                if (SDL_PollEvent(&amp;event) != 0) {&#xA;                        if (event.type == SDL_QUIT)&#xA;                        break;}&#xA;                    &#xA;                conv_pxlformat(scale, (v.pFrame)->data, (v.pFrame)->linesize, (v.pCodecCtx)->height);&#xA;                gettimeofday(&amp;tval_end, NULL);&#xA;                timersub(&amp;tval_end, &amp;tval_start, &amp;tval_duration);&#xA;                duration_usec = (long int)tval_duration.tv_sec * 1000000 &#x2B; (long int)tval_duration.tv_usec;&#xA;                &#xA;                while(duration_usec &lt; time_per_frame_usec) {&#xA;                gettimeofday(&amp;tval_end, NULL);&#xA;                timersub(&amp;tval_end, &amp;tval_start, &amp;tval_duration);&#xA;                duration_usec = (long int)tval_duration.tv_sec * 1000000 &#x2B; (long int)tval_duration.tv_usec;&#xA;                    }&#xA;                &#xA;                gettimeofday(&amp;tval_start, NULL);&#xA;                render_on_texture_update(wow, *(scale.buffer)); &#xA;                n&#x2B;&#x2B;;&#xA;        }&#xA;  &#xA;    gettimeofday(&amp;tval_end, NULL);&#xA;    timersub(&amp;tval_end, &amp;tval_start1, &amp;tval_duration);&#xA;    duration_usec = (long int)tval_duration.tv_sec * 1000000 &#x2B; (long int)tval_duration.tv_usec;&#xA;    &#xA;    printf("Total time and frames; %ld %i\n", duration_usec, n);&#xA;    &#xA;    if(vid_error == AVERROR(EAGAIN)){&#xA;                    printf("AVERROR(EAGAIN) occured\n)");&#xA;                    }   &#xA;                &#xA;    &#xA;    sws_freeContext(scale.ctx);&#xA;    free_sws(scale);&#xA;    close_window(wow);&#xA;    cap_close(v); &#xA;    return 0;   &#xA;}&#xA;&#xA;

    &#xA;

    the output is:&#xA;&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;mw_maze_test.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: isommp42&#xA;    creation_time   : 2014-02-14T21:09:52.000000Z&#xA;  Duration: 00:01:32.90, start: 0.000000, bitrate: 347 kb/s&#xA;    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 384x288 [SAR 1:1 DAR 4:3], 249 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2014-02-14T21:09:53.000000Z&#xA;      handler_name    : IsoMedia File Produced by Google, 5-11-2011&#xA;Time per frame: 40000&#xA;Total time and frames; 252881576 6322&#xA;&#xA;&#xA;

    &#xA;