
Recherche avancée
Autres articles (31)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette 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, parLa 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, parPHP 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 TheNeuronalCoderI 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 
#include 
#include 
#include "libavcodec/avcodec.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"

static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt, FILE *outfile) {
 int ret;
 ret = avcodec_send_frame(enc_ctx, frame);
 if (ret < 0) {
 fprintf(stderr, "error sending a frame for encoding\n");
 exit(1);
 }
 while (ret >= 0) {
 ret = avcodec_receive_packet(enc_ctx, pkt);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 return;
 else if (ret < 0) {
 fprintf(stderr, "error during encoding\n");
 exit(1);
 }
 printf("encoded frame %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
 fwrite(pkt->data, 1, pkt->size, outfile);
 av_packet_unref(pkt);
 }
}

int main() {
 const char *filename = "animation.mp4";
 const AVCodec *codec;
 AVCodecContext *c = NULL;
 int i, ret, x, y;
 FILE *f;
 AVFrame *picture;
 AVPacket *pkt;
 uint8_t endcode[] = { 0, 0, 1, 0xb7 };
 if (argc <= 1) {
 fprintf(stderr, "Usage: %s <output file="file">\n", argv[0]);
 exit(0);
 }
 avcodec_register_all();
 codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO);
 if (!codec) {
 fprintf(stderr, "codec not found\n");
 exit(1);
 }
 c = avcodec_alloc_context3(codec);
 picture = av_frame_alloc();
 pkt = av_packet_alloc();
 if (!pkt)
 exit(1);
 c->bit_rate = 400000;
 c->width = 352;
 c->height = 288;
 c->time_base = (AVRational){1, 25};
 c->framerate = (AVRational){25, 1};
 c->gop_size = 10;
 c->max_b_frames=1;
 c->pix_fmt = AV_PIX_FMT_YUV420P;
 if (avcodec_open2(c, codec, NULL) < 0) {
 fprintf(stderr, "could not open codec\n");
 exit(1);
 }
 f = fopen(filename, "wb");
 if (!f) {
 fprintf(stderr, "could not open %s\n", filename);
 exit(1);
 }
 picture->format = c->pix_fmt;
 picture->width = c->width;
 picture->height = c->height;
 ret = av_frame_get_buffer(picture, 32);
 if (ret < 0) {
 fprintf(stderr, "could not alloc the frame data\n");
 exit(1);
 }

 for(i=0;i<25;i++) {
 fflush(stdout);
 ret = av_frame_make_writable(picture);
 if (ret < 0)
 exit(1);

 for(y=0;yheight;y++) {
 for(x=0;xwidth;x++) {
 picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
 }
 }

 for(y=0;yheight/2;y++) {
 for(x=0;xwidth/2;x++) {
 picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
 picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
 }
 }

 picture->pts = i;
 encode(c, picture, pkt, f);
 }

 encode(c, NULL, pkt, f);

 fwrite(endcode, 1, sizeof(endcode), f);
 fclose(f);
 avcodec_free_context(&c);
 av_frame_free(&picture);
 av_packet_free(&pkt);
 return 0;
}
</output>


-
FFmpeg problems with playing a stream
13 avril 2021, par NikoI 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.


When i run

ffmpeg -i "udp://@:5555" -f alsa hw:0
i get a following error

[NULL @ 0x76b2b390] Requested output format 'alsa' is not a suitable output format
hw:0: Invalid argument



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


There is complete log :


root@LEDE:/proc/asound# ffmpeg -i "udp://@:5555" -f alsa hw:0
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
 built with gcc 5.4.0 (LEDE GCC 5.4.0 r3101-bce140e)
 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
 libavutil 55. 34.100 / 55. 34.100
 libavcodec 57. 64.101 / 57. 64.101
 libavformat 57. 56.100 / 57. 56.100
 libavdevice 57. 1.100 / 57. 1.100
 libavfilter 6. 65.100 / 6. 65.100
 libswscale 4. 2.100 / 4. 2.100
 libswresample 2. 3.100 / 2. 3.100
 libpostproc 54. 1.100 / 54. 1.100
Input #0, mpegts, from 'udp://@:5555':
 Duration: N/A, start: 1.400000, bitrate: 384 kb/s
 Program 1 
 Metadata:
 service_name : Service01
 service_provider: FFmpeg
 Stream #0:0[0x100]: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
[NULL @ 0x76b2b390] Requested output format 'alsa' is not a suitable output format
hw:0: Invalid argument



-
Unable to encode single frame h264 (.mp4) video with FFmpeg. No video stream present
1er avril 2021, par MaxitoI have achieved this with ffmpeg command line tool using the command. The folder had only one image.





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





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.



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.



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



The application output gives me this information :





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

 

[libx264 @ 20d1b840] profile High, level 4.0

 

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





These are my main parameters :



pCodecCtx->codec_id = AV_CODEC_ID_H264;
pCodecCtx->pix_fmt= AV_PIX_FMT_YUV420P; 
pCodecCtx->gop_size = 1;
pCodecCtx->bit_rate = 400000;
pCodecCtx->me_range = 16;
pCodecCtx->max_qdiff = 4;
pCodecCtx->qcompress = 0.6;
pCodecCtx->qmin = 0;
pCodecCtx->qmax = 25;
pCodecCtx->time_base.den = 24;
pCodecCtx->time_base.num = 1;

AVDictionary *param = 0;
 av_dict_set(&param, "preset", "slow", 0);
 av_dict_set(&param, "profile", "high", 0);
 av_dict_set(&param, "crf", "10", 0); //this gave me quality
 av_dict_set(&param, "force_key_frames", "1", 0);




In my encoding I just added



ppicture->pts = pCodecCtx->frame_number




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



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