
Advanced search
Medias (2)
-
Valkaama DVD Label
4 October 2011, by
Updated: February 2013
Language: English
Type: Picture
-
Podcasting Legal guide
16 May 2011, by
Updated: May 2011
Language: English
Type: Text
Other articles (84)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 September 2013, byCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo; l’ajout d’une bannière l’ajout d’une image de fond;
-
Ecrire une actualité
21 June 2013, byPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 June 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
On other websites (8942)
-
Revision a46f5459c3: improved speed of 4x4 sse2 fdct. * speed improvment of 30 percent achieved * mu
3 March 2014, by Andrew RussellChanged Paths:
Modify /vp9/encoder/x86/vp9_dct_sse2.c
improved speed of 4x4 sse2 fdct.* speed improvment of 30 percent achieved
* multiplies and adds remain the same
* non-arithmetic instructions minimized by hand, by:
-expanding 2 pass loop
-removing irrelivant "shuffles"
-combining last two rounding steps
* further improvments may be possibleChange-Id: Idec2c3f52910c48e6a0e0f9aefed5cae31b0b8c0
-
How to apply any mask.png on a video with ffmpeg
18 November 2022, by Talha KhalidI am adding a 1.mp4 on a video 2.mp4, and i want to add a mask on overlay video(1.mp4)




I want to apply this mask on 1.mp4

I'm using chrome key right now

ffmpeg -t 5 -r 30 -f lavfi -i color=c=black:s=640x360
 -i 1.mp4
 -i mask2.png
 -i 2.mp4
 -filter_complex "
 [1:v]scale=500x281[v1];
 [2]scale=500x281[mask];
 [v1][mask]overlay, chromakey=0x00FF00:0.25:0.08 [v2];
 [3:v]scale=640x360[v3];
 [0][v3]overlay [out1];
 [out1][v2]overlay=0:0"
 -y output.mp4





But it also removes color from videos.

I'm not sure but i think it can be done by negate

also i don't need audio command, i already done that part

Thanks

-
How to save video data in a vector using ffmpeg? (C++)
25 October 2022, by noklaI'm new to ffmpeg and I am trying to write a program for video editing.


I want to import a video file and save it somehow in a vector so I could edit its frames later.
When I saved all the decoded AVFrames in a vector I saw it takes a lot of memory and that I need to find a better way to do so.


The function I used for reading a video:


** the function is in a class that representing video,
source
type isstd::vector<avframe></avframe>


void VideoSource::ReadSource(std::string path)
{
 // Open the file using libavformat
 AVFormatContext* av_format_ctx = avformat_alloc_context();
 if (!av_format_ctx) {
 printf("Couldn't create AVFormatContext\n");
 return; 
 }
 if (avformat_open_input(&av_format_ctx, path.c_str(), NULL, NULL) != 0) {
 printf("Couldn't open video file\n");
 return;
 }

 // Find the first valid video stream inside the file
 int video_stream_index = -1;
 AVCodecParameters* av_codec_params = NULL;
 const AVCodec* av_codec = NULL;
 for (int i = 0; i < av_format_ctx->nb_streams; i)
 {
 av_codec_params = av_format_ctx->streams[i]->codecpar;
 av_codec = avcodec_find_decoder(av_codec_params->codec_id);

 if (!av_codec) {
 continue;
 }
 if (av_codec_params->codec_type == AVMEDIA_TYPE_VIDEO) {
 video_stream_index = i;
 break;
 }
 }

 if (video_stream_index == -1) {
 printf("Couldn't find valid video stream inside file\n");
 return;
 }

 // Set up a codec context for the decoder
 AVCodecContext* av_codec_ctx = avcodec_alloc_context3(av_codec);
 if (!av_codec_ctx) {
 printf("Couldn't create AVCpdecContext\n");
 return;
 }

 if (avcodec_parameters_to_context(av_codec_ctx, av_codec_params) < 0)
 {
 printf("Couldn't initialize AVCodecContext\n");
 return;
 }
 if (avcodec_open2(av_codec_ctx, av_codec, NULL) < 0) {
 printf("Couldn't open codec\n");
 return;
 }

 AVFrame* av_frame = av_frame_alloc();
 if (!av_frame) {
 printf("Couldn't allocate AVFrame\n");
 return;
 }
 AVPacket* av_packet = av_packet_alloc();
 if (!av_packet) {
 printf("Couldn't allocate AVPacket\n");
 return;
 }
 int response;

 while (av_read_frame(av_format_ctx, av_packet) >= 0) {
 if (av_packet->stream_index != video_stream_index) {
 av_packet_unref(av_packet);
 continue;
 }
 response = avcodec_send_packet(av_codec_ctx, av_packet);
 if (response < 0) {
 printf("Failed to decode packet: %s\n", av_err2str(response));
 return;
 }
 response = avcodec_receive_frame(av_codec_ctx, av_frame);
 if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
 av_packet_unref(av_packet);
 continue;
 }
 else if (response < 0) {
 printf("Failed to decode frame: %s\n", av_err2str(response));
 return;
 }
 av_packet_unref(av_packet);

 av_packet = av_packet_alloc();

 // response = avcodec_send_frame(av_codec_ctx, av_frame);

 source.push_back(*new AVFrame);
 source.back() = *av_frame_clone(av_frame);

 av_frame_unref(av_frame);
 }
 

 avformat_close_input(&av_format_ctx);
 avformat_free_context(av_format_ctx);
 av_frame_free(&av_frame);
 av_packet_free(&av_packet);
 avcodec_free_context(&av_codec_ctx);
}



I thought maybe I should save it as a vector of encoded AVFrames or as a vector of encoded packet that contains some frames in it.


When I tried to encode a single AVFrame, I added this line

response = avcodec_send_frame(av_codec_ctx, av_frame);
before pushing the frame into the vector (You can see it marked as a comment in the code above).

It returned invalid argument (-22) and I am not sure why.

Questions:


- 

- Why did I get that error (-22)?
- How to save an encoded packet with multiple AVFrame in it?
- Is there a better way of working on a video that won't take as much memory?