Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (22)

  • 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 (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (4233)

  • ffmpeg - dump_format() function print out 00:00:00

    16 juin 2013, par Juneyoung Oh

    I am working with ffmpeg.

    The only function that I needed is just extract duration of video on memory, not console.

    to do this, I realized that I have to redesign dump_format() function

    witch defined in avformat.h.

    below is the original source and especially what I need is dump_format

    that located in line 3063.

    http://ffmpeg.org/doxygen/0.6/libavformat_2utils_8c-source.html#l03063

    when I use dump_format, it returns everything fine but except duration.

    duration always returns 00:00:00.

    below is my test code. When I call line 31 is fine, but not 32.

    I want know what is wrong with my code.

    I suspect the fact that I dropped function dump_metadata.

    But everytime I use that function console prints undefined function error.

     1 #include <libavcodec></libavcodec>avcodec.h>
     2 #include <libavformat></libavformat>avformat.h>
     3 #include
     4 #include
     5 #include
     6
     7 void dump_format1(AVFormatContext* ic, int index, const char* url, int is_output);
     8
     9 int main(int argc, char *argv[]) {
    10         AVFormatContext* pFormatCtx;
    11         int secs;
    12         //need those for printing...
    13
    14         if(argc &lt; 2) {
    15                 printf("Please provide a movie file\n");
    16                 return -1;
    17         }
    18         //threat Exception for arguements.
    19
    20         av_register_all();
    21         //register all codecs
    22
    23         //========== Check Context
    24         if(av_open_input_file(&amp;pFormatCtx, argv[1], NULL, 0, NULL) != 0)
    25                 return -1;
    26
    27         if(av_find_stream_info(pFormatCtx) &lt; 0)
    28                 return -1;
    29
    30         //========== Print Basic Information
    31         //dump_format(pFormatCtx, 0 , argv[1], 0);
    32         dump_format1(pFormatCtx, 0 , argv[1], 0);
    33
    34
    35         if(pFormatCtx->duration != AV_NOPTS_VALUE){
    36                 secs = (pFormatCtx->duration) / AV_TIME_BASE;
    37         }
    38
    39         /*
    40                 AV_TIME_BASE = 1000000
    41         */
    42
    43         printf("%d\n",secs);
    44
    45         return 0;
    46 }
    47
    48 void dump_format1(AVFormatContext *ic,
    49                   int index,
    50                   const char *url,
    51                   int is_output) {
    52
    53         int i;
    54         uint8_t *printed = av_mallocz(ic->nb_streams);
    55         if (ic->nb_streams &amp;&amp; !printed)
    56                 return;
    57
    58         av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s &#39;%s&#39;:\n",
    59         is_output ? "Output" : "Input",
    60         index,
    61         is_output ? ic->oformat->name : ic->iformat->name,
    62         is_output ? "to" : "from", url);
    63
    64         dump_metadata(NULL, ic->metadata, "  ");
    65
    66         //if (!is_output) {
    67         av_log(NULL, AV_LOG_INFO, "  Duration: ");
    68
    69
    70
    71
    72         int hours, mins, secs, us;
    73         secs = ic->duration / AV_TIME_BASE;
    74         us = ic->duration % AV_TIME_BASE;
    75         mins = secs / 60;
    76         secs %= 60;
    77         hours = mins / 60;
    78         mins %= 60;
    79         av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
    80         (100 * us) / AV_TIME_BASE);
    81         return;
    82 }

    I compile with following commands.

    gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
    ./tutorial01 /home/juneyoungoh/Videos/CON1234ID.ts

    Thanks for your guidences in advance.

  • How AVCodecContext bitrate, framerate and timebase is used when encoding single frame

    28 mars 2023, par Cyrus

    I am trying to learn FFmpeg from examples as there is a tight schedule. The task is to encode a raw YUV image into JPEG format of the given width and height. I have found examples from ffmpeg official website, which turns out to be quite straight-forward. However there are some fields in AVCodecContext that I thought only makes sense when encoding videos(e.g. bitrate, framerate, timebase, gopsize, max_b_frames etc).

    &#xA;

    I understand on a high level what those values are when it comes to videos, but do I need to care about those when I just want a single image ? Currently for testing, I am just setting them as dummy values and it seems to work. But I want to make sure that I am not making terrible assumptions that will break in the long run.

    &#xA;

    EDIT :

    &#xA;

    Here is the code I got. Most of them are copy and paste from examples, with some changes to replace old APIs with newer ones.

    &#xA;

    #include "thumbnail.h"&#xA;#include "libavcodec/avcodec.h"&#xA;#include "libavutil/imgutils.h"&#xA;#include &#xA;#include &#xA;#include &#xA;&#xA;void print_averror(int error_code) {&#xA;    char err_msg[100] = {0};&#xA;    av_strerror(error_code, err_msg, 100);&#xA;    printf("Reason: %s\n", err_msg);&#xA;}&#xA;&#xA;ffmpeg_status_t save_yuv_as_jpeg(uint8_t* source_buffer, char* output_thumbnail_filename, int thumbnail_width, int thumbnail_height) {&#xA;    const AVCodec* mjpeg_codec = avcodec_find_encoder(AV_CODEC_ID_MJPEG);&#xA;    if (!mjpeg_codec) {&#xA;        printf("Codec for mjpeg cannot be found.\n");&#xA;        return FFMPEG_THUMBNAIL_CODEC_NOT_FOUND;&#xA;    }&#xA;&#xA;    AVCodecContext* codec_ctx = avcodec_alloc_context3(mjpeg_codec);&#xA;    if (!codec_ctx) {&#xA;        printf("Codec context cannot be allocated for the given mjpeg codec.\n");&#xA;        return FFMPEG_THUMBNAIL_ALLOC_CONTEXT_FAILED;&#xA;    }&#xA;&#xA;    AVPacket* pkt = av_packet_alloc();&#xA;    if (!pkt) {&#xA;        printf("Thumbnail packet cannot be allocated.\n");&#xA;        return FFMPEG_THUMBNAIL_ALLOC_PACKET_FAILED;&#xA;    }&#xA;&#xA;    AVFrame* frame = av_frame_alloc();&#xA;    if (!frame) {&#xA;        printf("Thumbnail frame cannot be allocated.\n");&#xA;        return FFMPEG_THUMBNAIL_ALLOC_FRAME_FAILED;&#xA;    }&#xA;&#xA;    // The part that I don&#x27;t understand&#xA;    codec_ctx->bit_rate = 400000;&#xA;    codec_ctx->width = thumbnail_width;&#xA;    codec_ctx->height = thumbnail_height;&#xA;    codec_ctx->time_base = (AVRational){1, 25};&#xA;    codec_ctx->framerate = (AVRational){1, 25};&#xA;&#xA;    codec_ctx->gop_size = 10;&#xA;    codec_ctx->max_b_frames = 1;&#xA;    codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    int ret = av_image_fill_arrays(frame->data, frame->linesize, source_buffer, AV_PIX_FMT_YUV420P, thumbnail_width, thumbnail_height, 32);&#xA;    if (ret &lt; 0) {&#xA;        print_averror(ret);&#xA;        printf("Pixel format: yuv420p, width: %d, height: %d\n", thumbnail_width, thumbnail_height);&#xA;        return FFMPEG_THUMBNAIL_FILL_FRAME_DATA_FAILED;&#xA;    }&#xA;&#xA;    ret = avcodec_send_frame(codec_ctx, frame);&#xA;    if (ret &lt; 0) {&#xA;        print_averror(ret);&#xA;        printf("Failed to send frame to encoder.\n");&#xA;        return FFMPEG_THUMBNAIL_FILL_SEND_FRAME_FAILED;&#xA;    }&#xA;&#xA;    ret = avcodec_receive_packet(codec_ctx, pkt);&#xA;    if (ret &lt; 0) {&#xA;        print_averror(ret);&#xA;        printf("Failed to receive packet from encoder.\n");&#xA;        return FFMPEG_THUMBNAIL_FILL_SEND_FRAME_FAILED;&#xA;    }&#xA;&#xA;    // store the thumbnail in output&#xA;    int fd = open(output_thumbnail_filename, O_CREAT | O_RDWR);&#xA;    write(fd, pkt->data, pkt->size);&#xA;    close(fd);&#xA;&#xA;    // freeing allocated structs&#xA;    avcodec_free_context(&amp;codec_ctx);&#xA;    av_frame_free(&amp;frame);&#xA;    av_packet_free(&amp;pkt);&#xA;    return FFMPEG_SUCCESS;&#xA;}&#xA;

    &#xA;

  • No such file or directory : 'ffprobe' : 'ffprobe'

    27 novembre 2023, par Jack McCumber

    I'm hoping someone can point me in the right direction. I'm currently trying to build a python GUI that plays clips of sounds from a specified file and allows the user to annotate it. All the research I've done has pointed my to using pydub. I'm using the following snippet :

    &#xA;

    from pydub import AudioSegment&#xA;from pydub.playback import play&#xA;&#xA;song = AudioSegment.from_wav("beepboop.mp3")&#xA;play(song)&#xA;

    &#xA;

    However, I'm currently getting the following error :

    &#xA;

    Warning (from warnings module):&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 170&#xA;    warn("Couldn&#x27;t find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)&#xA;RuntimeWarning: Couldn&#x27;t find ffmpeg or avconv - defaulting to ffmpeg, but may not work&#xA;&#xA;Warning (from warnings module):&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 198&#xA;    warn("Couldn&#x27;t find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)&#xA;RuntimeWarning: Couldn&#x27;t find ffprobe or avprobe - defaulting to ffprobe, but may not work&#xA;Traceback (most recent call last):&#xA;  File "/Users/jack/Desktop/code-repo/convert-csv-to-json/cleaner.py", line 7, in <module>&#xA;    song = AudioSegment.from_wav("beepboop.mp3")&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/audio_segment.py", line 808, in from_wav&#xA;    return cls.from_file(file, &#x27;wav&#x27;, parameters=parameters)&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/audio_segment.py", line 728, in from_file&#xA;    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pydub/utils.py", line 274, in mediainfo_json&#xA;    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__&#xA;    restore_signals, start_new_session)&#xA;  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child&#xA;    raise child_exception_type(errno_num, err_msg, err_filename)&#xA;FileNotFoundError: [Errno 2] No such file or directory: &#x27;ffprobe&#x27;: &#x27;ffprobe&#x27;&#xA;</module>

    &#xA;

    I've downloaded both ffprobe and ffmpeg from the official website, extracted the files, and installed to usr/local/bin based on input I've read in other StackOverflow comments. When I run :

    &#xA;

    print(os.environ[&#x27;PATH&#x27;])&#xA;

    &#xA;

    I get :

    &#xA;

    /usr/bin:/bin:/usr/sbin:/sbin&#xA;

    &#xA;

    Also, MacOSX won't let me manually drag the executable into /usr/bin or /usr/sbin. Nor will it let me copy it into the directory using :

    &#xA;

    $ sudo cp ffmpeg /usr/bin&#xA;

    &#xA;

    When I use :

    &#xA;

    pip3 install ffprobe-python&#xA;

    &#xA;

    I get :

    &#xA;

    Requirement already satisfied: ffprobe-python in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.3)&#xA;

    &#xA;

    I'll add that when I try and use the "apt install" method, it barks at me and says my version of MacOSX isn't supported.

    &#xA;