
Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (96)
-
Utilisation et configuration du script
19 janvier 2011, parInformations spécifiques à la distribution Debian
Si vous utilisez cette distribution, vous devrez activer les dépôts "debian-multimedia" comme expliqué ici :
Depuis la version 0.3.1 du script, le dépôt peut être automatiquement activé à la suite d’une question.
Récupération du script
Le script d’installation peut être récupéré de deux manières différentes.
Via svn en utilisant la commande pour récupérer le code source à jour :
svn co (...) -
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)
Sur d’autres sites (3434)
-
How to use ffmpeg api to make a filter overlay water mark ?
6 septembre 2022, par Leon LeeOS : Ubuntu 20.04


FFmpeg : 4.4.0


Test video :


Input #0, hevc, from './videos/akiyo_352x288p25.265' :
Duration : N/A, bitrate : N/A
Stream #0:0 : Video : hevc (Main), yuv420p(tv), 352x288, 25 fps, 25 tbr, 1200k tbn, 25 tbc


Test watermark :


200*200.png


I copy ffmpeg official example.


Compiler no error, run no error , but i can't see add watermark


Here is my code


#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>opt.h>
#include <libavfilter></libavfilter>buffersink.h>
#include <libavfilter></libavfilter>buffersrc.h>
int open_input_file(AVFormatContext *fmt, AVCodecContext **codecctx, AVCodec *codec, const char *filename, int index)
{
 int ret = 0;
 char msg[500];
 *codecctx = avcodec_alloc_context3(codec);
 ret = avcodec_parameters_to_context(*codecctx, fmt->streams[index]->codecpar);
 if (ret < 0)
 {
 printf("avcodec_parameters_to_context error,ret:%d\n", ret);
 
 return -1;
 }

 // open 解码器
 ret = avcodec_open2(*codecctx, codec, NULL);
 if (ret < 0)
 {
 printf("avcodec_open2 error,ret:%d\n", ret);
 
 return -2;
 }
 printf("pix:%d\n", (*codecctx)->pix_fmt);
 return ret;
}

int init_filter(AVFilterContext **buffersrc_ctx, AVFilterContext **buffersink_ctx, AVFilterGraph **filter_graph, AVStream *stream, AVCodecContext *codecctx, const char *filter_desc)
{
 int ret = -1;
 char args[512];
 char msg[500];
 const AVFilter *buffersrc = avfilter_get_by_name("buffer");
 const AVFilter *buffersink = avfilter_get_by_name("buffersink");

 AVFilterInOut *input = avfilter_inout_alloc();
 AVFilterInOut *output = avfilter_inout_alloc();

 AVRational time_base = stream->time_base;
 enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE};

 if (!output || !input || !filter_graph)
 {
 ret = -1;
 printf("avfilter_graph_alloc/avfilter_inout_alloc error,ret:%d\n", ret);
 
 goto end;
 }
 snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", codecctx->width, codecctx->height, codecctx->pix_fmt, stream->time_base.num, stream->time_base.den, codecctx->sample_aspect_ratio.num, codecctx->sample_aspect_ratio.den);
 ret = avfilter_graph_create_filter(buffersrc_ctx, buffersrc, "in", args, NULL, *filter_graph);
 if (ret < 0)
 {
 printf("avfilter_graph_create_filter buffersrc error,ret:%d\n", ret);
 
 goto end;
 }

 ret = avfilter_graph_create_filter(buffersink_ctx, buffersink, "out", NULL, NULL, *filter_graph);
 if (ret < 0)
 {
 printf("avfilter_graph_create_filter buffersink error,ret:%d\n", ret);
 
 goto end;
 }
 ret = av_opt_set_int_list(*buffersink_ctx, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
 if (ret < 0)
 {
 printf("av_opt_set_int_list error,ret:%d\n", ret);
 
 goto end;
 }
 /*
 * The buffer source output must be connected to the input pad of
 * the first filter described by filters_descr; since the first
 * filter input label is not specified, it is set to "in" by
 * default.
 */
 output->name = av_strdup("in");
 output->filter_ctx = *buffersrc_ctx;
 output->pad_idx = 0;
 output->next = NULL;

 /*
 * The buffer sink input must be connected to the output pad of
 * the last filter described by filters_descr; since the last
 * filter output label is not specified, it is set to "out" by
 * default.
 */
 input->name = av_strdup("out");
 input->filter_ctx = *buffersink_ctx;
 input->pad_idx = 0;
 input->next = NULL;

 if ((ret = avfilter_graph_parse_ptr(*filter_graph, filter_desc, &input, &output, NULL)) < 0)
 {
 printf("avfilter_graph_parse_ptr error,ret:%d\n", ret);
 
 goto end;
 }

 if ((ret = avfilter_graph_config(*filter_graph, NULL)) < 0)
 {
 printf("avfilter_graph_config error,ret:%d\n", ret);
 
 goto end;
 }
 end:
 avfilter_inout_free(&input);
 avfilter_inout_free(&output);
 return ret;
}

int main(int argc, char **argv)
{
 int ret;
 char msg[500];
 const char *filter_descr = "drawbox=x=100:y=100:w=100:h=100:color=pink@0.5"; // OK
 //const char *filter_descr = "movie=200.png[wm];[in][wm]overlay=10:10[out]"; //Test
 // const char *filter_descr = "scale=640:360,transpose=cclock";
 AVFormatContext *pFormatCtx = NULL;
 AVCodecContext *pCodecCtx;
 AVFilterContext *buffersink_ctx;
 AVFilterContext *buffersrc_ctx;
 AVFilterGraph *filter_graph;
 AVCodec *codec;
 int video_stream_index = -1;

 AVPacket packet;
 AVFrame *pFrame;
 AVFrame *pFrame_out;
 filter_graph = avfilter_graph_alloc();
 FILE *fp_yuv = fopen("test.yuv", "wb+");
 ret = avformat_open_input(&pFormatCtx, argv[1], NULL, NULL);
 if (ret < 0)
 {
 printf("avformat_open_input error,ret:%d\n", ret);
 
 return -1;
 }

 ret = avformat_find_stream_info(pFormatCtx, NULL);
 if (ret < 0)
 {
 printf("avformat_find_stream_info error,ret:%d\n", ret);
 
 return -2;
 }

 ret = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
 if (ret < 0)
 {
 printf("av_find_best_stream error,ret:%d\n", ret);
 
 return -3;
 }
 // 获取到视频流索引
 video_stream_index = ret;

 av_dump_format(pFormatCtx, 0, argv[1], 0);
 if ((ret = open_input_file(pFormatCtx, &pCodecCtx, codec, argv[1], video_stream_index)) < 0)
 {
 ret = -1;
 printf("open_input_file error,ret:%d\n", ret);
 
 goto end;
 }

 if ((ret = init_filter(&buffersrc_ctx, &buffersink_ctx, &filter_graph, pFormatCtx->streams[video_stream_index], pCodecCtx, filter_descr)) < 0)
 {
 ret = -2;
 printf("init_filter error,ret:%d\n", ret);
 
 goto end;
 }
 pFrame = av_frame_alloc();
 pFrame_out = av_frame_alloc();
 while (1)
 {
 if ((ret = av_read_frame(pFormatCtx, &packet)) < 0)
 break;

 if (packet.stream_index == video_stream_index)
 {
 ret = avcodec_send_packet(pCodecCtx, &packet);
 if (ret < 0)
 {
 printf("avcodec_send_packet error,ret:%d\n", ret);
 
 break;
 }

 while (ret >= 0)
 {
 ret = avcodec_receive_frame(pCodecCtx, pFrame);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 {
 break;
 }
 else if (ret < 0)
 {
 printf("avcodec_receive_frame error,ret:%d\n", ret);
 
 goto end;
 }

 pFrame->pts = pFrame->best_effort_timestamp;

 /* push the decoded frame into the filtergraph */
 ret = av_buffersrc_add_frame_flags(buffersrc_ctx, pFrame, AV_BUFFERSRC_FLAG_KEEP_REF);
 if (ret < 0)
 {
 printf("av_buffersrc_add_frame_flags error,ret:%d\n", ret);
 
 break;
 }

 /* pull filtered frames from the filtergraph */
 while (1)
 {
 ret = av_buffersink_get_frame(buffersink_ctx, pFrame_out);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 break;
 if (ret < 0)
 goto end;
 if (pFrame_out->format == AV_PIX_FMT_YUV420P)
 {
 //Y, U, V
 for (int i = 0; i < pFrame_out->height; i++)
 {
 fwrite(pFrame_out->data[0] + pFrame_out->linesize[0] * i, 1, pFrame_out->width, fp_yuv);
 }
 for (int i = 0; i < pFrame_out->height / 2; i++)
 {
 fwrite(pFrame_out->data[1] + pFrame_out->linesize[1] * i, 1, pFrame_out->width / 2, fp_yuv);
 }
 for (int i = 0; i < pFrame_out->height / 2; i++)
 {
 fwrite(pFrame_out->data[2] + pFrame_out->linesize[2] * i, 1, pFrame_out->width / 2, fp_yuv);
 }
 }
 av_frame_unref(pFrame_out);
 }
 av_frame_unref(pFrame);
 }
 }
 av_packet_unref(&packet);
 }
 end:
 avcodec_free_context(&pCodecCtx);
 fclose(fp_yuv);
}



-
Matomo Celebrates 15 Years of Building an Open-Source & Transparent Web Analytics Solution
-
What is the correct way of running test cases(in headless firefox) in xvfb and record the test cases using ffmpeg
31 juillet 2022, par Saran Rajhttps://malinowski.dev/recording-headless-selenium-tests-to-mp4.html this is the link i am using but i don't even know how to do all these.I don't know whether i should run all the commands in that as a single script or should i run the xvfb command in one terminal and then open a new window for ffmpeg command for x11 grab.So,can anyone elaborate the steps for running test cases in xvfb and record the same.