
Recherche avancée
Autres articles (77)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-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 (7990)
-
FFmpeg - resize by max width/height, keep aspect ratio and avoid "width/height not divisible by 2" error
29 août 2020, par Eduard UnruhThis is the code I'm using to resize the video to either max width 640 or max height 700 and keeping the aspect ratio :


ffmpeg/bin/ffmpeg.exe" -y -i ttt.mp4 -profile:v high -c:v libx264 -filter_complex "scale=iw*min(1\,min(640/iw\,700/ih)):-1" -acodec copy -maxrate 600k -bufsize 300k -crf 18 ttt2.mp4



On some video I either get
width not divisible by 2
orheight not divisible by 2


I looked up that the solution would be :


-vf "crop=trunc(iw/2)*2:trunc(ih/2)*2"



So I tried :


ffmpeg/bin/ffmpeg.exe" -y -i ttt.mp4 -profile:v high -c:v libx264 -filter_complex "scale=iw*min(1\,min(640/iw\,700/ih)):-1" -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" -acodec copy -maxrate 600k -bufsize 300k -crf 18 ttt2.mp4



and get the error :


-vf/-af/-filter and -filter_complex cannot be used together for the same stream



so how to do this ??


-
aacdec : move from scalefactor ranged arrays to flat arrays
14 mai 2024, par Lynneaacdec : move from scalefactor ranged arrays to flat arrays
AAC uses an unconventional system to send scalefactors
(the volume+quantization value for each band).
Each window is split into either 1 or 8 blocks (long vs short),
and transformed separately from one another, with the coefficients
for each being also completely independent. The scalefactors
slightly increase from 64 (long) to 128 (short) to accomodate
better per-block-per-band volume for each window.To reduce overhead, the codec signals scalefactor sizes in an obtuse way,
where each group's scalefactor types are sent via a variable length decoding,
with a range.
But our decoder was written in a way where those ranges were carried through
the entire decoder, and to actually read them you had to use the range.Instead of having a dedicated array with a range for each scalefactor,
just let the decoder directly index each scalefactor.This also switches the form of quantized scalefactors to the format
the spec uses, where for intensity stereo and regular, scalefactors
are stored in a scalefactor - 100 form, rather than as-is.USAC gets rid of the complex scalefactor handling. This commit permits
for code sharing between both. -
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>