Recherche avancée

Médias (0)

Mot : - Tags -/page unique

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

Autres articles (31)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

Sur d’autres sites (6473)

  • Why does the official LibAV 12 video example not work properly ?

    11 avril 2021, par TheNeuronalCoder

    I would say the title is quite self-explanatory, but I nearly completely copied the example given by LibAV right here and yet the output video it produced was not playable. Why is it not playable ? Am I using the wrong file extension ? I do not understand what I could have possibly done wrong here and there's little to no documentation I could find for how to encode mp4 video in C++.

    


    #include &#xA;#include &#xA;#include &#xA;#include "libavcodec/avcodec.h"&#xA;#include "libavutil/frame.h"&#xA;#include "libavutil/imgutils.h"&#xA;&#xA;static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, FILE *outfile) {&#xA;    int ret;&#xA;    ret = avcodec_send_frame(enc_ctx, frame);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "error sending a frame for encoding\n");&#xA;        exit(1);&#xA;    }&#xA;    while (ret >= 0) {&#xA;        ret = avcodec_receive_packet(enc_ctx, pkt);&#xA;        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;            return;&#xA;        else if (ret &lt; 0) {&#xA;            fprintf(stderr, "error during encoding\n");&#xA;            exit(1);&#xA;        }&#xA;        printf("encoded frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);&#xA;        fwrite(pkt->data, 1, pkt->size, outfile);&#xA;        av_packet_unref(pkt);&#xA;    }&#xA;}&#xA;&#xA;int main() {&#xA;    const char *filename = "animation.mp4";&#xA;    const AVCodec *codec;&#xA;    AVCodecContext *c = NULL;&#xA;    int i, ret, x, y;&#xA;    FILE *f;&#xA;    AVFrame *picture;&#xA;    AVPacket *pkt;&#xA;    uint8_t endcode[] = { 0, 0, 1, 0xb7 };&#xA;    if (argc &lt;= 1) {&#xA;        fprintf(stderr, "Usage: %s <output file="file">\n", argv[0]);&#xA;        exit(0);&#xA;    }&#xA;    avcodec_register_all();&#xA;    codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO);&#xA;    if (!codec) {&#xA;        fprintf(stderr, "codec not found\n");&#xA;        exit(1);&#xA;    }&#xA;    c = avcodec_alloc_context3(codec);&#xA;    picture = av_frame_alloc();&#xA;    pkt = av_packet_alloc();&#xA;    if (!pkt)&#xA;        exit(1);&#xA;    c->bit_rate = 400000;&#xA;    c->width = 352;&#xA;    c->height = 288;&#xA;    c->time_base = (AVRational){1, 25};&#xA;    c->framerate = (AVRational){25, 1};&#xA;    c->gop_size = 10;&#xA;    c->max_b_frames=1;&#xA;    c->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    if (avcodec_open2(c, codec, NULL) &lt; 0) {&#xA;        fprintf(stderr, "could not open codec\n");&#xA;        exit(1);&#xA;    }&#xA;    f = fopen(filename, "wb");&#xA;    if (!f) {&#xA;        fprintf(stderr, "could not open %s\n", filename);&#xA;        exit(1);&#xA;    }&#xA;    picture->format = c->pix_fmt;&#xA;    picture->width  = c->width;&#xA;    picture->height = c->height;&#xA;    ret = av_frame_get_buffer(picture, 32);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "could not alloc the frame data\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    for(i=0;i&lt;25;i&#x2B;&#x2B;) {&#xA;        fflush(stdout);&#xA;        ret = av_frame_make_writable(picture);&#xA;        if (ret &lt; 0)&#xA;            exit(1);&#xA;&#xA;        for(y=0;yheight;y&#x2B;&#x2B;) {&#xA;            for(x=0;xwidth;x&#x2B;&#x2B;) {&#xA;                picture->data[0][y * picture->linesize[0] &#x2B; x] = x &#x2B; y &#x2B; i * 3;&#xA;            }&#xA;        }&#xA;&#xA;        for(y=0;yheight/2;y&#x2B;&#x2B;) {&#xA;            for(x=0;xwidth/2;x&#x2B;&#x2B;) {&#xA;                picture->data[1][y * picture->linesize[1] &#x2B; x] = 128 &#x2B; y &#x2B; i * 2;&#xA;                picture->data[2][y * picture->linesize[2] &#x2B; x] = 64 &#x2B; x &#x2B; i * 5;&#xA;            }&#xA;        }&#xA;&#xA;        picture->pts = i;&#xA;        encode(c, picture, pkt, f);&#xA;    }&#xA;&#xA;    encode(c, NULL, pkt, f);&#xA;&#xA;    fwrite(endcode, 1, sizeof(endcode), f);&#xA;    fclose(f);&#xA;    avcodec_free_context(&amp;c);&#xA;    av_frame_free(&amp;picture);&#xA;    av_packet_free(&amp;pkt);&#xA;    return 0;&#xA;}&#xA;</output>

    &#xA;

  • FFmpeg problems with playing a stream

    13 avril 2021, par Niko

    I want to play a stream over network. While my server works I can't get it working receiving audio on client. It's router with openwrt installed and usb soundcard.

    &#xA;

    When i run&#xA;ffmpeg -i "udp://@:5555" -f alsa hw:0 i get a following error

    &#xA;

    [NULL @ 0x76b2b390] Requested output format &#x27;alsa&#x27; is not a suitable output format&#xA;hw:0: Invalid argument&#xA;

    &#xA;

    What's wrong with my command ?&#xA;On router there is limited space. I hardly handled to install ffmpeg.

    &#xA;

    There is complete log :

    &#xA;

    root@LEDE:/proc/asound# ffmpeg -i "udp://@:5555" -f alsa hw:0&#xA;ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers&#xA;  built with gcc 5.4.0 (LEDE GCC 5.4.0 r3101-bce140e)&#xA;  configuration: --enable-cross-compile --cross-prefix=mips-openwrt-linux-musl- --arch=mips --target-os=linux --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static --enable-small --enable-pthreads --enable-zlib --disable-doc --disable-debug --enable-gpl --enable-version3 --disable-dxva2 --disable-lzma --disable-vaapi --disable-vda --disable-vdpau --disable-outdevs --disable-altivec --disable-vsx --disable-power8 --disable-amd3dnow --disable-amd3dnowext --disable-mmx --disable-mmxext --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-xop --disable-fma3 --disable-fma4 --disable-avx2 --disable-aesni --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-inline-asm --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi --disable-fast-unaligned --disable-runtime-cpudetect --disable-yasm --enable-libopus --enable-decoder=libopus --enable-libx264 --enable-libmp3lame&#xA;  libavutil      55. 34.100 / 55. 34.100&#xA;  libavcodec     57. 64.101 / 57. 64.101&#xA;  libavformat    57. 56.100 / 57. 56.100&#xA;  libavdevice    57.  1.100 / 57.  1.100&#xA;  libavfilter     6. 65.100 /  6. 65.100&#xA;  libswscale      4.  2.100 /  4.  2.100&#xA;  libswresample   2.  3.100 /  2.  3.100&#xA;  libpostproc    54.  1.100 / 54.  1.100&#xA;Input #0, mpegts, from &#x27;udp://@:5555&#x27;:&#xA;  Duration: N/A, start: 1.400000, bitrate: 384 kb/s&#xA;  Program 1 &#xA;    Metadata:&#xA;      service_name    : Service01&#xA;      service_provider: FFmpeg&#xA;    Stream #0:0[0x100]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s&#xA;[NULL @ 0x76b2b390] Requested output format &#x27;alsa&#x27; is not a suitable output format&#xA;hw:0: Invalid argument&#xA;

    &#xA;

  • Unable to encode single frame h264 (.mp4) video with FFmpeg. No video stream present

    1er avril 2021, par Maxito

    I have achieved this with ffmpeg command line tool using the command. The folder had only one image.

    &#xA;&#xA;

    &#xA;

    ffmpeg -r 24 -i image%03d.bmp -c:v libx264 -pix_fmt yuv420p&#xA; oneframex.mp4

    &#xA;

    &#xA;&#xA;

    I would like to do the same with C++. If I encode a video of three or more frames, video encodes correctly, but the result of encoding a one or two frames video never has a video stream, as reported by ffprobe and some media players.

    &#xA;&#xA;

    Comparing with ffprobe, my video (the one with three or more frames) and the one generated by the command tool show almost the same information. Only bitrate and encoder version are different.

    &#xA;&#xA;

    I have tried adding force_key_frames to 1, tried with many encoding options and have be unsuccessful.

    &#xA;&#xA;

    The application output gives me this information :

    &#xA;&#xA;

    &#xA;

    [libx264 @ 20d1b840] using cpu capabilities : MMX2 SSE2Fast SSSE3&#xA; SSE4.2 AVX

    &#xA; &#xA;

    [libx264 @ 20d1b840] profile High, level 4.0

    &#xA; &#xA;

    [libx264 @ 20d1b840] 264 - core 142 r2431 ac76440 - H.264/MPEG-4 AVC&#xA; codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html -&#xA; options : cabac=0 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=dia subme=8&#xA; psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=0 trellis=0&#xA; 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2&#xA; threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1&#xA; interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0&#xA; keyint=1 keyint_min=1 scenecut=0 intra_refresh=0 rc=crf mbtree=0&#xA; crf=10.0 qcomp=0.60 qpmin=0 qpmax=25 qpstep=4 ip_ratio=1.40 aq=1:1.00

    &#xA;

    &#xA;&#xA;

    These are my main parameters :

    &#xA;&#xA;

    pCodecCtx->codec_id = AV_CODEC_ID_H264;&#xA;pCodecCtx->pix_fmt= AV_PIX_FMT_YUV420P; &#xA;pCodecCtx->gop_size = 1;&#xA;pCodecCtx->bit_rate = 400000;&#xA;pCodecCtx->me_range = 16;&#xA;pCodecCtx->max_qdiff = 4;&#xA;pCodecCtx->qcompress = 0.6;&#xA;pCodecCtx->qmin = 0;&#xA;pCodecCtx->qmax = 25;&#xA;pCodecCtx->time_base.den = 24;&#xA;pCodecCtx->time_base.num = 1;&#xA;&#xA;AVDictionary *param = 0;&#xA;            av_dict_set(&amp;param, "preset", "slow", 0);&#xA;            av_dict_set(&amp;param, "profile", "high", 0);&#xA;            av_dict_set(&amp;param, "crf", "10", 0); //this gave me quality&#xA;            av_dict_set(&amp;param, "force_key_frames", "1", 0);&#xA;

    &#xA;&#xA;

    In my encoding I just added

    &#xA;&#xA;

    ppicture->pts = pCodecCtx->frame_number&#xA;

    &#xA;&#xA;

    to avoid non-strictly-monotonic PTS message. And tried the methods from this question in case it had something to do.

    &#xA;&#xA;

    I’m sure I must be missing some important parameter to be able to create such a small video. I will take any suggestion.

    &#xA;