Recherche avancée

Médias (91)

Autres articles (30)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (3915)

  • Bash : displaying selected output, do not print unnecessary output

    2 juillet 2014, par Guillaume

    I don’t know if it’s possible :
    I’m using ffmpeg and I would like to reduce the output of a command. I have this result :

    ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
     built on Jun 17 2014 11:08:12 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
     configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-libvidstab --enable-libx265
     libavutil      52. 89.100 / 52. 89.100
     libavcodec     55. 67.100 / 55. 67.100
     libavformat    55. 43.100 / 55. 43.100
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  8.100 /  4.  8.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, hls,applehttp, from 'http://ftvodhdsecz-f.akamaihd.net/i/streaming-adaptatif_france-dom-tom/2014/S26/J7/104904507-20140629-,398,632,934,k.mp4.csmil/index_2_av.m3u8?null=':
     Duration: 00:51:05.07, start: 0.100667, bitrate: 0 kb/s
     Program 0
       Metadata:
         variant_bitrate : 0
       Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 704x396 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 67 kb/s
       Stream #0:2: Data: timed_id3 (ID3  / 0x20334449)
    File '/media/path/video.mkv' already exists. Overwrite ? [y/N] y
    [matroska @ 0x2958840] Error parsing AAC extradata, unable to determine samplerate.
    Output #0, matroska, to '/media/path/video.mkv':
     Metadata:
       encoder         : Lavf55.43.100
       Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 704x396 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 90k tbc
       Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, 67 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [hls,applehttp @ 0x2864c20] Failed to open segment of playlist 0ate= 844.6kbits/s    
    frame= 3000 fps=174 q=-1.0 Lsize=   12325kB time=00:02:00.00 bitrate= 841.4kbits/s

    I just would like to have this 4 informations :

    1) Duration: 00:51:05.07, start: 0.100667, bitrate: 0 kb/s
    2)  File '/media/path/video.mkv' already exists. Overwrite ? [y/N] y
    3)  Output #0, matroska, to '/media/path/video.mkv':
    4)  frame= 3000 fps=174 q=-1.0 Lsize=   12325kB time=00:02:00.00 bitrate= 841.4kbits/s

    I’ve tried the -v option, but the output is either -v info (this long output), or -v warning, or -v error. There’s not what I would like to have.
    I’ve seen this question but the output is totally clear. Can I put an exception for specially string ?
    Thanks all

    Edit : my line in my script is like that :

    ffmpeg -i "${M3U2}" -vcodec copy -acodec copy "${Directory}/${PROG}_${ID}.mkv"
  • Split a movie so that each GIF is under a certain file size

    9 novembre 2014, par Terence Eden

    Problem

    I want to convert a long movie into a series on animated GIFs.

    Each GIF needs to be <5MB.

    Is there any way to determine how large a GIF will be while it is being encoded ?

    Progress So Far

    I can split the movie into individual frames :

    ffmpeg -i movie.ogv -r 25 frameTemp.%05d.gif

    I can then use convert from ImageMagick to create GIFs. However, I can’t find a way to determine the likely file size before running the command.

    Alternatively, I can split the movie into chunks :

    ffmpeg -i movie.ogv -vcodec copy -ss 00:00:00 -t 00:20:00 output1.ogv

    But I’ve no way of knowing if, when I convert the file to a GIF it will be under 5MB.

    A 10 second scene with a lot of action may be over 5MB (bad !) and a static scene could be under 5MB (not a problem, but not very efficient).

    Ideas

    I think that what I want to do is convert the entire movie into a GIF, then find a way to split it by file size.

    Looking at ImageMagick, I can split a GIF into frames, but I don’t see a way to split it into animated GIFs of a certain size / length.

    So, is this possible ?

  • Linker error by trying example program with ffmpeg

    11 mars, par Chris

    I think this might be a stupid question and I'm just blind but that thing is driving me nuts for hours now.&#xA;I downloaded ffmpeg and build it. Now I want to try the thing out in a program but I can't setup cmake to link ffmpeg properly and have no idea what is wrong.

    &#xA;

    The linker always tells me this :

    &#xA;

    christoph@christoph-ThinkPad-T490:~/develop/ffmpg_example/build$ make&#xA;[ 50%] Linking CXX executable test&#xA;CMakeFiles/test.dir/main.cxx.o: In function `main&#x27;:&#xA;main.cxx:(.text&#x2B;0x180): undefined reference to `av_register_all()&#x27;&#xA;main.cxx:(.text&#x2B;0x1a7): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)&#x27;&#xA;main.cxx:(.text&#x2B;0x1ce): undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)&#x27;&#xA;main.cxx:(.text&#x2B;0x206): undefined reference to `av_dump_format(AVFormatContext*, int, char const*, int)&#x27;&#xA;main.cxx:(.text&#x2B;0x2bb): undefined reference to `avcodec_find_decoder(AVCodecID)&#x27;&#xA;main.cxx:(.text&#x2B;0x2fc): undefined reference to `avcodec_alloc_context3(AVCodec const*)&#x27;&#xA;main.cxx:(.text&#x2B;0x316): undefined reference to `avcodec_copy_context(AVCodecContext*, AVCodecContext const*)&#x27;&#xA;main.cxx:(.text&#x2B;0x361): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)&#x27;&#xA;main.cxx:(.text&#x2B;0x377): undefined reference to `av_frame_alloc()&#x27;&#xA;main.cxx:(.text&#x2B;0x383): undefined reference to `av_frame_alloc()&#x27;&#xA;main.cxx:(.text&#x2B;0x3ba): undefined reference to `avpicture_get_size(AVPixelFormat, int, int)&#x27;&#xA;main.cxx:(.text&#x2B;0x3d0): undefined reference to `av_malloc(unsigned long)&#x27;&#xA;main.cxx:(.text&#x2B;0x3ff): undefined reference to `avpicture_fill(AVPicture*, unsigned char const*, AVPixelFormat, int, int)&#x27;&#xA;main.cxx:(.text&#x2B;0x43d): undefined reference to `sws_getContext(int, int, AVPixelFormat, int, int, AVPixelFormat, int, SwsFilter*, SwsFilter*, double const*)&#x27;&#xA;main.cxx:(.text&#x2B;0x465): undefined reference to `av_read_frame(AVFormatContext*, AVPacket*)&#x27;&#xA;main.cxx:(.text&#x2B;0x49f): undefined reference to `avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)&#x27;&#xA;main.cxx:(.text&#x2B;0x4fd): undefined reference to `sws_scale(SwsContext*, unsigned char const* const*, int const*, int, int, unsigned char* const*, int const*)&#x27;&#xA;main.cxx:(.text&#x2B;0x545): undefined reference to `av_free_packet(AVPacket*)&#x27;&#xA;main.cxx:(.text&#x2B;0x556): undefined reference to `av_free(void*)&#x27;&#xA;main.cxx:(.text&#x2B;0x565): undefined reference to `av_frame_free(AVFrame**)&#x27;&#xA;main.cxx:(.text&#x2B;0x574): undefined reference to `av_frame_free(AVFrame**)&#x27;&#xA;main.cxx:(.text&#x2B;0x580): undefined reference to `avcodec_close(AVCodecContext*)&#x27;&#xA;main.cxx:(.text&#x2B;0x58f): undefined reference to `avcodec_close(AVCodecContext*)&#x27;&#xA;main.cxx:(.text&#x2B;0x59e): undefined reference to `avformat_close_input(AVFormatContext**)&#x27;&#xA;collect2: error: ld returned 1 exit status&#xA;CMakeFiles/test.dir/build.make:87: recipe for target &#x27;test&#x27; failed&#xA;make[2]: *** [test] Error 1&#xA;CMakeFiles/Makefile2:75: recipe for target &#x27;CMakeFiles/test.dir/all&#x27; failed&#xA;make[1]: *** [CMakeFiles/test.dir/all] Error 2&#xA;Makefile:83: recipe for target &#x27;all&#x27; failed&#xA;make: *** [all] Error 2&#xA;

    &#xA;

    The cmake list looks like this :

    &#xA;

    cmake_minimum_required(VERSION 3.16)&#xA;&#xA;project(ffmpeg_test)&#xA;&#xA;add_library(avformat STATIC IMPORTED)&#xA;set_target_properties(avformat&#xA;    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavformat.a&#xA;)&#xA;add_library(avcodec STATIC IMPORTED)&#xA;set_target_properties(avcodec&#xA;    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavcodec.a&#xA;)&#xA;add_library(swscale STATIC IMPORTED)&#xA;set_target_properties(swscale&#xA;    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libswscale.a&#xA;)&#xA;add_library(avutil STATIC IMPORTED)&#xA;set_target_properties(avutil&#xA;    PROPERTIES IMPORTED_LOCATION /home/christoph/develop/FFmpeg/build/lib/libavutil.a&#xA;)&#xA;add_executable(test main.cxx)&#xA;&#xA;target_link_libraries(test PRIVATE&#xA;    /home/christoph/develop/FFmpeg/build/lib/libavformat.a&#xA;    avcodec&#xA;    swscale&#xA;    avutil&#xA;)&#xA;target_include_directories(test PRIVATE /home/christoph/develop/FFmpeg/build/include)&#xA;

    &#xA;

    And here are the ffmpeg libs :

    &#xA;

    christoph@christoph-ThinkPad-T490:~/develop/FFmpeg/build/lib$ ll&#xA;total 277840&#xA;drwxr-xr-x  3 christoph christoph      4096 Dez  7 23:59 ./&#xA;drwxr-xr-x 17 christoph christoph      4096 Dez  7 23:59 ../&#xA;-rw-r--r--  1 christoph christoph 173479270 Dez  7 23:59 libavcodec.a&#xA;-rw-r--r--  1 christoph christoph   2174910 Dez  7 23:59 libavdevice.a&#xA;-rw-r--r--  1 christoph christoph  37992438 Dez  7 23:59 libavfilter.a&#xA;-rw-r--r--  1 christoph christoph  59222040 Dez  7 23:59 libavformat.a&#xA;-rw-r--r--  1 christoph christoph   4759514 Dez  7 23:59 libavutil.a&#xA;-rw-r--r--  1 christoph christoph    695698 Dez  7 23:59 libswresample.a&#xA;-rw-r--r--  1 christoph christoph   6164398 Dez  7 23:59 libswscale.a&#xA;drwxr-xr-x  2 christoph christoph      4096 Dez  7 23:59 pkgconfig/&#xA;

    &#xA;

    And this is the example code :

    &#xA;

    #include&#xA;&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;&#xA;// compatibility with newer API&#xA;#if LIBAVCODEC_VERSION_INT &lt; AV_VERSION_INT(55,28,1)&#xA;#define av_frame_alloc avcodec_alloc_frame&#xA;#define av_frame_free avcodec_free_frame&#xA;#endif&#xA;&#xA;void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {&#xA;  FILE *pFile;&#xA;  char szFilename[32];&#xA;  int  y;&#xA;  &#xA;  // Open file&#xA;  sprintf(szFilename, "frame%d.ppm", iFrame);&#xA;  pFile=fopen(szFilename, "wb");&#xA;  if(pFile==NULL)&#xA;    return;&#xA;  &#xA;  // Write header&#xA;  fprintf(pFile, "P6\n%d %d\n255\n", width, height);&#xA;  &#xA;  // Write pixel data&#xA;  for(y=0; ydata[0]&#x2B;y*pFrame->linesize[0], 1, width*3, pFile);&#xA;  &#xA;  // Close file&#xA;  fclose(pFile);&#xA;}&#xA;&#xA;int main(int argc, char *argv[]) {&#xA;  // Initalizing these to NULL prevents segfaults!&#xA;  AVFormatContext   *pFormatCtx = NULL;&#xA;  int               i, videoStream;&#xA;  AVCodecContext    *pCodecCtxOrig = NULL;&#xA;  AVCodecContext    *pCodecCtx = NULL;&#xA;  AVCodec           *pCodec = NULL;&#xA;  AVFrame           *pFrame = NULL;&#xA;  AVFrame           *pFrameRGB = NULL;&#xA;  AVPacket          packet;&#xA;  int               frameFinished;&#xA;  int               numBytes;&#xA;  uint8_t           *buffer = NULL;&#xA;  struct SwsContext *sws_ctx = NULL;&#xA;&#xA;  if(argc &lt; 2) {&#xA;    printf("Please provide a movie file\n");&#xA;    return -1;&#xA;  }&#xA;  // Register all formats and codecs&#xA;  av_register_all();&#xA;  &#xA;  // Open video file&#xA;  if(avformat_open_input(&amp;pFormatCtx, argv[1], NULL, NULL)!=0)&#xA;    return -1; // Couldn&#x27;t open file&#xA;  &#xA;  // Retrieve stream information&#xA;  if(avformat_find_stream_info(pFormatCtx, NULL)&lt;0)&#xA;    return -1; // Couldn&#x27;t find stream information&#xA;  &#xA;  // Dump information about file onto standard error&#xA;  av_dump_format(pFormatCtx, 0, argv[1], 0);&#xA;  &#xA;  // Find the first video stream&#xA;  videoStream=-1;&#xA;  for(i=0; inb_streams; i&#x2B;&#x2B;)&#xA;    if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {&#xA;      videoStream=i;&#xA;      break;&#xA;    }&#xA;  if(videoStream==-1)&#xA;    return -1; // Didn&#x27;t find a video stream&#xA;  &#xA;  // Get a pointer to the codec context for the video stream&#xA;  pCodecCtxOrig=pFormatCtx->streams[videoStream]->codec;&#xA;  // Find the decoder for the video stream&#xA;  pCodec=avcodec_find_decoder(pCodecCtxOrig->codec_id);&#xA;  if(pCodec==NULL) {&#xA;    fprintf(stderr, "Unsupported codec!\n");&#xA;    return -1; // Codec not found&#xA;  }&#xA;  // Copy context&#xA;  pCodecCtx = avcodec_alloc_context3(pCodec);&#xA;  if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0) {&#xA;    fprintf(stderr, "Couldn&#x27;t copy codec context");&#xA;    return -1; // Error copying codec context&#xA;  }&#xA;&#xA;  // Open codec&#xA;  if(avcodec_open2(pCodecCtx, pCodec, NULL)&lt;0)&#xA;    return -1; // Could not open codec&#xA;  &#xA;  // Allocate video frame&#xA;  pFrame=av_frame_alloc();&#xA;  &#xA;  // Allocate an AVFrame structure&#xA;  pFrameRGB=av_frame_alloc();&#xA;  if(pFrameRGB==NULL)&#xA;    return -1;&#xA;&#xA;  // Determine required buffer size and allocate buffer&#xA;  numBytes=avpicture_get_size(AV_PIX_FMT_RGB24, pCodecCtx->width,&#xA;                  pCodecCtx->height);&#xA;  buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));&#xA;  &#xA;  // Assign appropriate parts of buffer to image planes in pFrameRGB&#xA;  // Note that pFrameRGB is an AVFrame, but AVFrame is a superset&#xA;  // of AVPicture&#xA;  avpicture_fill((AVPicture *)pFrameRGB, buffer, AV_PIX_FMT_RGB24,&#xA;         pCodecCtx->width, pCodecCtx->height);&#xA;  &#xA;  // initialize SWS context for software scaling&#xA;  sws_ctx = sws_getContext(pCodecCtx->width,&#xA;               pCodecCtx->height,&#xA;               pCodecCtx->pix_fmt,&#xA;               pCodecCtx->width,&#xA;               pCodecCtx->height,&#xA;               AV_PIX_FMT_RGB24,&#xA;               SWS_BILINEAR,&#xA;               NULL,&#xA;               NULL,&#xA;               NULL&#xA;               );&#xA;&#xA;  // Read frames and save first five frames to disk&#xA;  i=0;&#xA;  while(av_read_frame(pFormatCtx, &amp;packet)>=0) {&#xA;    // Is this a packet from the video stream?&#xA;    if(packet.stream_index==videoStream) {&#xA;      // Decode video frame&#xA;      avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished, &amp;packet);&#xA;      &#xA;      // Did we get a video frame?&#xA;      if(frameFinished) {&#xA;    // Convert the image from its native format to RGB&#xA;    sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,&#xA;          pFrame->linesize, 0, pCodecCtx->height,&#xA;          pFrameRGB->data, pFrameRGB->linesize);&#xA;    &#xA;    // Save the frame to disk&#xA;    if(&#x2B;&#x2B;i&lt;=5)&#xA;      SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, &#xA;            i);&#xA;      }&#xA;    }&#xA;    &#xA;    // Free the packet that was allocated by av_read_frame&#xA;    av_free_packet(&amp;packet);&#xA;  }&#xA;  &#xA;  // Free the RGB image&#xA;  av_free(buffer);&#xA;  av_frame_free(&amp;pFrameRGB);&#xA;  &#xA;  // Free the YUV frame&#xA;  av_frame_free(&amp;pFrame);&#xA;  &#xA;  // Close the codecs&#xA;  avcodec_close(pCodecCtx);&#xA;  avcodec_close(pCodecCtxOrig);&#xA;&#xA;  // Close the video file&#xA;  avformat_close_input(&amp;pFormatCtx);&#xA;  &#xA;  return 0;&#xA;}&#xA;

    &#xA;