Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (77)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (11186)

  • Use ffmpeg to stream live content to azure media services

    19 mars 2018, par Dadicool

    I’ve been trying to stream content to azure media services using ffmpeg as it’s one of the options described here : http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/

    My command is :

    ffmpeg -v verbose -i 300.mp4 -strict -2 -c:a aac -b:a 128k -ar 44100 -r 30 -g 60 -keyint_min 60 -b:v 400000 -c:v libx264 -preset medium -bufsize 400k -maxrate 400k -f flv rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7

    I have made sure that the streaming endpoint has one active streaming unit, I also made sure that the channel is actually Ready and I even get it to start streaming (which makes a PublishURL available).

    When I execute the ffmpeg command to start streaming, I keep getting the following error :

    ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
     built on Dec 30 2014 11:31:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Routing option strict to both codec and muxer layer
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] overread end of atom 'colr' by 1 bytes
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] stream 0, timescale not set
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] max_analyze_duration 5000000 reached at 5003637 microseconds
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       creation_time   : 2014-01-11 05:39:32
       genre           : Trailer
       artist          : Warner Bros.
       title           : 300: Rise of an Empire - Trailer 2
       encoder         : HandBrake 0.9.9 2013051800
       date            : 2014
     Duration: 00:02:33.24, start: 0.000000, bitrate: 7377 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 (1920x1088), 7219 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
         encoder         : JVT/AVC Coding
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
       Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc
    rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7: Input/output error

    The Azure blog post clearly states that this should be possible but I can’t find a working example anywhere.

    Environment :

    • MacOS Maverick
    • FFMPEG installed from official build
    • 300.mp4 : 1080p trailer of the latest 300 movie
  • using ffmpeg libavcodec encode video stream to H264, why duration is zero

    26 mars 2019, par Qing

    Need help, recently, I am using ffmpeg libavcodec to decode a video file then encode to H264 and write to an mp4 media container, finally, the media file’s duration is zero, the following is my code’s workflow:

    AVFormatContext*    input_format_context = NULL;
    AVFormatContext*    output_format_context = NULL;
    AVIOContext*        output_io_context = NULL;
    AVCodecContext*     input_codec_context = NULL;
    AVCodecContext*     output_codec_context = NULL;
    AVCodec*            codec = NULL;
    AVStream*           input_stream = NULL;
    AVStream*           output_stream = NULL;
    AVFrame*            frame = NULL;

    int convert_init(const char* input_filename, const char* output_filename)
    {
       /** Allocate a new encode context */
       avformat_open_input(&input_format_context,
               input_filename, NULL, NULL);

       /** Get information on the input file (number of streams etc.). */
       avformat_find_stream_info(input_format_context, NULL);  

       /** Open the output file to write to it. */
       avio_open(&output_io_context, output_filename,
               AVIO_FLAG_WRITE);

       /** Create a new format context for the output container format. */
       output_format_context = avformat_alloc_context();

       /** Associate the output file (pointer) with the container format context. */
       output_format_context->pb = output_io_context;

       /** Guess the desired container format based on the file extension. */
       output_format_context->oformat = av_guess_format(NULL,
               output_filename, NULL);

       av_strlcpy((output_format_context)->filename, output_filename,
               sizeof(output_format_context->filename));

       /** stream0 is the video stream */
       AVStream* input_stream = input_format_context->streams[0];


       /**
        * Init the input_codec_context
        */

       /** Find a decoder for the audio stream. */
       codec = avcodec_find_decoder(input_stream->codecpar->codec_id);

       /** Allocate a new decode context */
       input_codec_context = avcodec_alloc_context3(codec);

       /** Initialize the stream parameters with demuxer information */
       avcodec_parameters_to_context(input_codec_context,
               input_stream->codecpar);    

       /** Open the decoder for the stream. */
       avcodec_open2(input_codec_context, codec, NULL);                                

       /**
        *  Create an output stream for writing encoded data
        *
        *  AM I MISSING SOMETHING ?
        *
        */
       output_stream = avformat_new_stream(output_format_context, NULL);

       /**
        * Init the output_codec_context
        */
       /** Find a encoder for the output video stream, using H264. */
       codec = avcodec_find_encoder(AV_CODEC_ID_H264);    

       /** Allocate an encode context. */
       output_codec_context = avcodec_alloc_context3(codec);  

       /**
        *  Setup encode context parameters.
        *  
        *  AM I MISSING SOMETHING ?
        *
        * */
       output_codec_context->bit_rate = input_codec_context->bit_rate;
       output_codec_context->width = input_codec_context->width;
       output_codec_context->height = input_codec_context->height;
       output_codec_context->time_base = (AVRational){1, 25};
       output_codec_context->framerate = (AVRational){25, 1};
       output_codec_context->gop_size = 10;
       output_codec_context->max_b_frames = 1;
       output_codec_context->pix_fmt = AV_PIX_FMT_YUV420P;
       output_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

       /** Setup output_stream codecpar. */
       avcodec_parameters_from_context(output_stream->codecpar,
               codec_context);

       /** Alloc an av frame */
       frame = av_frame_alloc();          

    }

    void convert_it()
    {
       AVPacket input_packet;
       AVPacket output_packet;

       /** Write the media file container header */
       avformat_write_header(output_format_context, NULL);

       /**
        * decode frames and encode to H264
        * */
       while (1) {
           av_init_packet(&input_packet);
           input_packet.data = NULL;
           input_packet.size = 0;

           av_init_packet(&output_packet);
           output_packet.data = NULL;
           output_packet.size = 0;

           /** Read a frame to decode */
           av_read_frame(input_format_context, &input_packet);        
           if (av_read_frame is end of file) {
               break;
           }
           ...
           ...

           /** Decoding... */
           avcodec_send_packet(input_codec_context, &input_packet);
           ...
           ...

           /** Get a decoded frame */
           avcodec_receive_frame(input_codec_context, frame);
           ...
           ...

           /** Make the frame writable, is it necessary ?? */
           av_frame_make_writable(frame);

           /** Encode to H264 */
           avcodec_send_frame(output_codec_context, frame);
           ...
           ...

           /** Get a encoded packet */
           avcodec_receive_packet(output_codec_context, &output_packet);

           /**
            * Write the packet to output.  
            * Here is the point! should I configure the parameters
            * in packet such as 'pts', 'dts', 'duration', etc, if so,
            * hwo? or I just directly write the packet into output?
            */
           av_interleaved_write_frame(output_format_context, &packet);                
       }

       /** Write the media file container trailer */
       av_write_trailer(output_format_context);

    }

    int main() {
       convert_init("./sample.avi", "./output.mp4");
       convert_it();

    }

    using VLC or QuickTime to playback the output.mp4 file, it failed, cause the file duration is zero, when dragging the time progress bar, I can see the picture frame clearly, it seems that the encoding packet buffer data is correct, but the timestamp is error, am I missing something when configure the output_stream or packet ? The following is message from ffprobe.

    ffprobe output.mp4
    ffprobe version 3.3.3 Copyright (c) 2007-2017 the FFmpeg developers
     built with Apple LLVM version 8.1.0 (clang-802.0.42)
     configuration: --enable-shared --enable-libmp3lame
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:00:00.06, start: 0.000000, bitrate: 6902181 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x408 [SAR 1:1 DAR 30:17], 13929056 kb/s, 90k fps, 90k tbr, 90k tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
  • using ffmpeg libavcodec to decode a video file then encode to H264, media file's duration is zero

    1er septembre 2017, par Qing

    Need help, recently, I am using ffmpeg libavcodec to decode a video file then encode to H264 and write to an mp4 media container, finally, the media file’s duration is zero, the following is my code’s workflow:

    AVFormatContext*    input_format_context = NULL;
    AVFormatContext*    output_format_context = NULL;
    AVIOContext*        output_io_context = NULL;
    AVCodecContext*     input_codec_context = NULL;
    AVCodecContext*     output_codec_context = NULL;
    AVCodec*            codec = NULL;
    AVStream*           input_stream = NULL;
    AVStream*           output_stream = NULL;
    AVFrame*            frame = NULL;

    int convert_init(const char* input_filename, const char* output_filename)
    {
       /** Allocate a new encode context */
       avformat_open_input(&input_format_context,
               input_filename, NULL, NULL);

       /** Get information on the input file (number of streams etc.). */
       avformat_find_stream_info(input_format_context, NULL);  

       /** Open the output file to write to it. */
       avio_open(&output_io_context, output_filename,
               AVIO_FLAG_WRITE);

       /** Create a new format context for the output container format. */
       output_format_context = avformat_alloc_context();

       /** Associate the output file (pointer) with the container format context. */
       output_format_context->pb = output_io_context;

       /** Guess the desired container format based on the file extension. */
       output_format_context->oformat = av_guess_format(NULL,
               output_filename, NULL);

       av_strlcpy((output_format_context)->filename, output_filename,
               sizeof(output_format_context->filename));

       /** stream0 is the video stream */
       AVStream* input_stream = input_format_context->streams[0];


       /**
        * Init the input_codec_context
        */

       /** Find a decoder for the audio stream. */
       codec = avcodec_find_decoder(input_stream->codecpar->codec_id);

       /** Allocate a new decode context */
       input_codec_context = avcodec_alloc_context3(codec);

       /** Initialize the stream parameters with demuxer information */
       avcodec_parameters_to_context(input_codec_context,
               input_stream->codecpar);    

       /** Open the decoder for the stream. */
       avcodec_open2(input_codec_context, codec, NULL);                                

       /**
        *  Create an output stream for writing encoded data
        *
        *  AM I MISSING SOMETHING ?
        *
        */
       output_stream = avformat_new_stream(output_format_context, NULL);

       /**
        * Init the output_codec_context
        */
       /** Find a encoder for the output video stream, using H264. */
       codec = avcodec_find_encoder(AV_CODEC_ID_H264);    

       /** Allocate an encode context. */
       output_codec_context = avcodec_alloc_context3(codec);  

       /**
        *  Setup encode context parameters.
        *  
        *  AM I MISSING SOMETHING ?
        *
        * */
       output_codec_context->bit_rate = input_codec_context->bit_rate;
       output_codec_context->width = input_codec_context->width;
       output_codec_context->height = input_codec_context->height;
       output_codec_context->time_base = (AVRational){1, 25};
       output_codec_context->framerate = (AVRational){25, 1};
       output_codec_context->gop_size = 10;
       output_codec_context->max_b_frames = 1;
       output_codec_context->pix_fmt = AV_PIX_FMT_YUV420P;
       output_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

       /** Setup output_stream codecpar. */
       avcodec_parameters_from_context(output_stream->codecpar,
               codec_context);

       /** Alloc an av frame */
       frame = av_frame_alloc();          

    }

    void convert_it()
    {
       AVPacket input_packet;
       AVPacket output_packet;

       /** Write the media file container header */
       avformat_write_header(output_format_context, NULL);

       /**
        * decode frames and encode to H264
        * */
       while (1) {
           av_init_packet(&input_packet);
           input_packet.data = NULL;
           input_packet.size = 0;

           av_init_packet(&output_packet);
           output_packet.data = NULL;
           output_packet.size = 0;

           /** Read a frame to decode */
           av_read_frame(input_format_context, &input_packet);        
           if (av_read_frame is end of file) {
               break;
           }
           ...
           ...

           /** Decoding... */
           avcodec_send_packet(input_codec_context, &input_packet);
           ...
           ...

           /** Get a decoded frame */
           avcodec_receive_frame(input_codec_context, frame);
           ...
           ...

           /** Make the frame writable, is it necessary ?? */
           av_frame_make_writable(frame);

           /** Encode to H264 */
           avcodec_send_frame(output_codec_context, frame);
           ...
           ...

           /** Get a encoded packet */
           avcodec_receive_packet(output_codec_context, &output_packet);

           /**
            * Write the packet to output.  
            * Here is the point! should I configure the parameters
            * in packet such as 'pts', 'dts', 'duration', etc, if so,
            * hwo? or I just directory write the packet to output?
            */
           av_interleaved_write_frame(output_format_context, &packet);                
       }

       /** Write the media file container trailer */
       av_write_trailer(output_format_context);

    }

    int main() {
       convert_init("./sample.avi", "./output.mp4");
       convert_it();

    }

    using VLC or QuickTime to playback the output.mp4 file, it failed, cause the file duration is zero, when dragging the time progress bar, I can see the picture frame clearly, it seems that the encoding packet buffer data is correct, but the timestamp is error, am I missing something when configure the output_stream ? The following is message from ffprobe.

    ffprobe output.mp4
    ffprobe version 3.3.3 Copyright (c) 2007-2017 the FFmpeg developers
     built with Apple LLVM version 8.1.0 (clang-802.0.42)
     configuration: --enable-shared --enable-libmp3lame
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:00:00.06, start: 0.000000, bitrate: 6902181 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x408 [SAR 1:1 DAR 30:17], 13929056 kb/s, 90k fps, 90k tbr, 90k tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler