Recherche avancée

Médias (91)

Autres articles (57)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (13874)

  • FFmpeg encoding live audio to aac issue

    12 juillet 2015, par Ruurd Adema

    I’m trying to encode live raw audio coming from a Blackmagic Decklink input card to a mov file with AAC encoding.

    The issue is that the audio sounds distorted and plays to fast.

    I created the software based on a couple of examples/tutorials including the Dranger tutorial and examples on Github (and of course the examples in the FFmpeg codebase).

    Honestly, at this moment I don’t exactly know what the cause of the problem is. I’m thinking about PTS/DTS values or a timebase mismatch (because of the too fast playout), I tried a lot of things, including working with an av_audio_fifo.

    • When outputting to the mov file with the AV_CODEC_ID_PCM_S16LE codec, everything works well
    • When outputting to the mov file with the AV_CODEC_ID_AAC codec, the problems occur
    • When writing RAW audio VLC media info shows :
      Type : Audio, Codec : PCM S16 LE (sowt), Language : English, Channels : Stereo, Sample rate : 48000 Hz, Bits per sample.
    • When writing with AAC codec VLC media info shows :
      Type : Audio, Codec : MPEG AAC Audio (mp4a), Language : English, Channels : Stereo, Sample rate : 48000 Hz.

    Any idea(s) of what’s causing the problems ?

    Code

    // Create output context

    output_filename = "/root/movies/encoder_debug.mov";
    output_format_name = "mov";
    if (avformat_alloc_output_context2(&output_fmt_ctx, NULL, output_format_name, output_filename) < 0)
    {
       printf("[ERROR] Unable to allocate output format context for output: %s\n", output_filename);
    }

    // Create audio output stream

    static AVStream *encoder_add_audio_stream(AVFormatContext *oc, enum AVCodecID codec_id)
    {
       AVCodecContext  *c;
       AVCodec         *codec;
       AVStream        *st;

       st = avformat_new_stream(oc, NULL);
       if (!st)
       {
           printf("[ERROR] Could not allocate new audio stream!\n");
           exit(-1);
       }

       c                 = st->codec;
       c->codec_id       = codec_id;
       c->codec_type     = AVMEDIA_TYPE_AUDIO;
       c->sample_fmt     = AV_SAMPLE_FMT_S16;
       c->sample_rate    = decklink_config()->audio_samplerate;
       c->channels       = decklink_config()->audio_channel_count;
       c->channel_layout = av_get_default_channel_layout(decklink_config()->audio_channel_count);
       c->time_base.den  = decklink_config()->audio_samplerate;
       c->time_base.num  = 1;

       if (codec_id == AV_CODEC_ID_AAC)
       {
           c->bit_rate       = 96000;  
           //c->profile = FF_PROFILE_AAC_MAIN; //FIXME Generates error: "Unable to set the AOT 1: Invalid config"
           // Allow the use of the experimental AAC encoder
           c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
       }

       // Some formats want stream headers to be seperate (global?)
       if (oc->oformat->flags & AVFMT_GLOBALHEADER)
       {
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;
       }

       codec = avcodec_find_encoder(c->codec_id);
       if (!codec)
       {
           printf("[ERROR] Audio codec not found\n");
           exit(-1);
       }

       if (avcodec_open2(c, codec, NULL) < 0)
       {
           printf("[ERROR] Could not open audio codec\n");
           exit(-1);
       }

       return st;
    }

    // En then, at every incoming frame this function gets called:

    void encoder_handle_incoming_frame(IDeckLinkVideoInputFrame *videoframe, IDeckLinkAudioInputPacket *audiopacket)
    {
       void *pixels = NULL;
       int   pitch = 0;
       int got_packet = 0;

       void *audiopacket_data          = NULL;
       long  audiopacket_sample_count  = 0;
       long  audiopacket_size          = 0;
       long  audiopacket_channel_count = 2;

       if (audiopacket)
       {  
           AVPacket pkt = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
           AVFrame *frame;
           BMDTimeValue audio_pts;
           int requested_size;
           static int last_pts1, last_pts2 = 0;

           audiopacket_sample_count  = audiopacket->GetSampleFrameCount();
           audiopacket_channel_count = decklink_config()->audio_channel_count;
           audiopacket_size          = audiopacket_sample_count * (decklink_config()->audio_sampletype/8) * audiopacket_channel_count;

           audiopacket->GetBytes(&audiopacket_data);

           av_init_packet(&pkt);    

           printf("\n=== Audiopacket: %d ===\n", audio_stream->codec->frame_number);

           if (AUDIO_TYPE == AV_CODEC_ID_PCM_S16LE)
           {
               audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);

               pkt.pts          = audio_pts;
               pkt.dts          = pkt.pts;
               pkt.flags       |= AV_PKT_FLAG_KEY;                 // TODO: Make sure if this still applies
               pkt.stream_index = audio_stream->index;
               pkt.data         = (uint8_t *)audiopacket_data;
               pkt.size         = audiopacket_size;

               printf("[PACKET] size:              %d\n", pkt.size);
               printf("[PACKET] pts:               %li\n", pkt.pts);
               printf("[PACKET] pts delta:         %li\n", pkt.pts - last_pts2);
               printf("[PACKET] duration:          %d\n", pkt.duration);
               last_pts2 = pkt.pts;

               av_interleaved_write_frame(output_fmt_ctx, &pkt);
           }
           else if (AUDIO_TYPE == AV_CODEC_ID_AAC)
           {
               frame = av_frame_alloc();
               frame->format = audio_stream->codec->sample_fmt;
               frame->channel_layout = audio_stream->codec->channel_layout;
               frame->sample_rate = audio_stream->codec->sample_rate;
               frame->nb_samples = audiopacket_sample_count;

               requested_size = av_samples_get_buffer_size(NULL, audio_stream->codec->channels, audio_stream->codec->frame_size, audio_stream->codec->sample_fmt, 1);

               audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);

               printf("[DEBUG] Sample format:      %d\n", frame->format);
               printf("[DEBUG] Channel layout:     %li\n", frame->channel_layout);
               printf("[DEBUG] Sample rate:        %d\n", frame->sample_rate);
               printf("[DEBUG] NB Samples:         %d\n", frame->nb_samples);
               printf("[DEBUG] Datasize:           %li\n", audiopacket_size);
               printf("[DEBUG] Requested datasize: %d\n", requested_size);
               printf("[DEBUG] Too less/much:      %li\n", audiopacket_size - requested_size);
               printf("[DEBUG] Framesize:          %d\n", audio_stream->codec->frame_size);
               printf("[DEBUG] Audio pts:          %li\n", audio_pts);
               printf("[DEBUG] Audio pts delta:    %li\n", audio_pts - last_pts1);
               last_pts1 = audio_pts;

               frame->pts = audio_pts;

               if (avcodec_fill_audio_frame(frame, audiopacket_channel_count, audio_stream->codec->sample_fmt, (const uint8_t *)audiopacket_data, audiopacket_size, 0) < 0)
               {
                   printf("[ERROR] Filling audioframe failed!\n");
                   exit(-1);
               }

               got_packet = 0;
               if (avcodec_encode_audio2(audio_stream->codec, &pkt, frame, &got_packet) != 0)
               {
                   printf("[ERROR] Encoding audio failed\n");
               }

               if (got_packet)
               {
                   pkt.stream_index = audio_stream->index;
                   pkt.flags       |= AV_PKT_FLAG_KEY;

                   //printf("[PACKET] size:              %d\n", pkt.size);
                   //printf("[PACKET] pts:               %li\n", pkt.pts);
                   //printf("[PACKET] pts delta:         %li\n", pkt.pts - last_pts2);
                   //printf("[PACKET] duration:          %d\n", pkt.duration);
                   //printf("[PACKET] timebase codec:    %d/%d\n", audio_stream->codec->time_base.num, audio_stream->codec->time_base.den);
                   //printf("[PACKET] timebase stream:   %d/%d\n", audio_stream->time_base.num, audio_stream->time_base.den);
                   last_pts2 = pkt.pts;

                   av_interleaved_write_frame(output_fmt_ctx, &pkt);
               }
               av_frame_free(&frame);
           }

           av_free_packet(&pkt);
       }
       else
       {
           printf("[WARNING] No audiopacket received!\n");
       }

       static int count = 0;
       count++;
    }
  • lavu : Adding ARIB STD-B67 (hybrid log-gamma) enum value and transfer function.

    21 avril 2016, par Neil Birkbeck
    lavu : Adding ARIB STD-B67 (hybrid log-gamma) enum value and transfer function.
    

    Adding hybrid log-gamma (https://en.wikipedia.org/wiki/Hybrid_Log-Gamma)
    based on the standardization in ARIB STD-B67 :
    http://www.arib.or.jp/english/html/overview/doc/2-STD-B67v1_0.pdf

    The choice of enum value of 18 is consistent with HEVC :
    http://phenix.it-sudparis.eu/jct/doc_end_user/current_document.php?id=10481

    And also with latest proposal for color format in mkv :
    https://mailarchive.ietf.org/arch/search/?email_list=cellar&gbt=1&q=Colour+Format+proposal

    The implementation assumes a nominal input range of [0, 1], which is
    consistent with HEVC.

    Signed-off-by : Neil Birkbeck <neil.birkbeck@gmail.com>
    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavutil/color_utils.c
    • [DH] libavutil/pixdesc.c
    • [DH] libavutil/pixfmt.h
    • [DH] tests/ref/fate/color_utils
  • ffmpeg : Cannot open libx265 encoder. Error initializing output stream 0:0 — Error while opening encoder for output stream #0:0

    16 mai 2018, par bnge

    Sorry for my bad English. I am trying to use ffmpeg to convert some image to heic format. Most of them were succeeded, but some large jpeg (seems only jpeg, png will be okay) files not.

    How can I improve my command to compatible all my images, so I can convert them automatically ?

    ➜  ~ ffmpeg -i sample.jpg -crf 12 -preset placebo -pix_fmt yuv420p -f hevc bitstream.265
    ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
     built with Apple LLVM version 9.1.0 (clang-902.0.39.1)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
     libavutil      56. 14.100 / 56. 14.100
     libavcodec     58. 18.100 / 58. 18.100
     libavformat    58. 12.100 / 58. 12.100
     libavdevice    58.  3.100 / 58.  3.100
     libavfilter     7. 16.100 /  7. 16.100
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  1.100 /  5.  1.100
     libswresample   3.  1.100 /  3.  1.100
     libpostproc    55.  1.100 / 55.  1.100
    Input #0, image2, from 'sample.jpg':
     Duration: 00:00:00.04, start: 0.000000, bitrate: 5226869 kb/s
       Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 13333x4200, 25 tbr, 25 tbn, 25 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (mjpeg (native) -> hevc (libx265))
    Press [q] to stop, [?] for help
    [swscaler @ 0x7fd2e3006000] deprecated pixel format used, make sure you did set range correctly
    x265 [info]: HEVC encoder version 2.7
    x265 [info]: build info [Mac OS X][clang 9.0.0][64 bit] 8bit+10bit+12bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    x265 [error]: Picture width must be an integer multiple of the specified chroma subsampling
    [libx265 @ 0x7fd2e2802a00] Cannot open libx265 encoder.
    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    Conversion failed!