
Recherche avancée
Autres articles (98)
-
À propos des documents
21 juin 2013, parQue faire quand un document ne passe pas en traitement, dont le rendu ne correspond pas aux attentes ?
Document bloqué en file d’attente ?
Voici une liste d’actions ordonnée et empirique possible pour tenter de débloquer la situation : Relancer le traitement du document qui ne passe pas Retenter l’insertion du document sur le site MédiaSPIP Dans le cas d’un média de type video ou audio, retravailler le média produit à l’aide d’un éditeur ou un transcodeur. Convertir le document dans un format (...) -
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (8521)
-
ffmpeg motion interpolation alternatives or speedup
22 février 2017, par UralI use ffmpeg to create videos, it is awesome tool. I create videos from pictures and need to make them as smooth as possible. I found, that what I need called ’motion interpolation’. I started to search all forums, and found only 3 things can help me : slowmovideo, butterflow and new ffmpeg’s filter minterpolate.
slowmovideo needs many configuration, I was not able to get it to work as I want.
with butterflow, I tried anything. From installing OpenCL, OpenGL and other stuff to switching to nvidia binary drivers and installing all sdk tools and cuda. It never worked. Some error about cuda, and google don’t know about it.So third option was the only one available. When I tried it, it did exactly what I want ! But it is incredibly SLOW. I have 8-core CPU, and it processes about 0.1-0.3 fps. And uses just 1 CORE, no video card.
Is there any ways to motion interpolate frames on GPU or on CPU but faster ? Only GNU/Linux
-
ffmpeg : recording audio + video into separate files, pressing 'q' or ctrl-C, audio is truncated
9 août 2018, par zzzeekTrying to record from the camera and sound card at the same time. If I use the "-t" option with a fixed time, both streams come out fine. If I try to break out while it’s recording, by pressing either ’q’ or ctrl-C, the audio stream is cut typically 5 seconds short.
I’ve tried many many options, codecs, -presets, combinations of everything, changing the order of the streams, usually with no luck. the thing that works the "best" is -preset ultrafast -threads 0, however I find when using these options, the program doesn’t exit cleanly and I can’t find documentation for what "-threads 0" really means (even though its name seems obvious).
Here’s the basic command :
ffmpeg -y -f alsa -i default -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -map 0:a out.wav -map 1:v out.mkv
-
How to save h264 frames as jpeg images using ffmpeg ?
17 août 2020, par Matthew CzarnekI would like to save thumbnails from a h264 stream that I'm turning into ffmpeg avpackets as jpegs.


I'm started with a h264 AVPacket (iframe) and decode it into an AVFrame using avcodec_send_packet/avcodec_receive_frame. Now trying to go from AVFrame and convert into AVPacket using avcodec_send_frame/avcodec_receive_packet


I can convert to png instead jpg, though I do get a the video looking like it's outputting three separate frames squeezed side by side into one. Wondering if it's one frame is R, next G, and finally B. I'm not sure, clearly I'm doing something wrong there. I figured it's possible it's the png encoder and I don't need it, so let's get jpg working first. But jpg is outputting unopenable files.


Any advice ?


Here is my code :


int output_thumbnails(AVPacket* video_packet)
{
 char png_file_name[max_chars_per_filename];
 char thumbnail_id_char[10];
 _itoa_s(thumbnail_id, thumbnail_id_char, 10);
 strcpy_s(png_file_name, max_chars_per_filename, time_stamped_filepath);
 strcat_s(png_file_name, max_chars_per_filename, time_stamped_filename);
 strcat_s(png_file_name, max_chars_per_filename, thumbnail_id_char);
 strcat_s(png_file_name, max_chars_per_filename, ".jpg");
 thumbnail_id++;

 int error_code = send_AVPacket_to_videocard(video_packet, av_codec_context_RTSP);

 //if (error_code == AVERROR_EOF)
 //{
 // // error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP, av_codec_RTSP);
 //}
 if (error_code == AVERROR(EAGAIN)) //send packets to videocard until function returns EAGAIN
 {
 error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP);

 //EAGAIN means that the video card buffer is ready to have the png pulled off of it
 if (error_code == AVERROR_EOF)
 {
 // error_code = videocard_to_PNG(png_file_name, av_codec_context_RTSP, av_codec_RTSP);
 }
 else if (error_code == AVERROR(EAGAIN))
 {

 }
 else
 {
 deal_with_av_errors(error_code, __LINE__, __FILE__);
 }
 }
 else
 {
 deal_with_av_errors(error_code, __LINE__, __FILE__);
 }
 
 return 0;
}



VideoThumbnailGenerator.h :
#include "VideoThumbnailGenerator.h"


bool decoder_context_created = false;
bool encoder_context_created = false;

AVCodecContext* h264_decoder_codec_ctx;
AVCodecContext* thumbnail_encoder_codec_ctx;

int send_AVPacket_to_videocard(AVPacket* packet, AVCodecContext* codec_ctx)
{
 if(!decoder_context_created)
 {
 AVCodec* h264_codec = avcodec_find_decoder(codec_ctx->codec_id);
 h264_decoder_codec_ctx = avcodec_alloc_context3(h264_codec);

 h264_decoder_codec_ctx->width = codec_ctx->width;
 h264_decoder_codec_ctx->height = codec_ctx->height;
 h264_decoder_codec_ctx->pix_fmt = AV_PIX_FMT_RGB24;
 h264_decoder_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;
 h264_decoder_codec_ctx->skip_frame = AVDISCARD_NONINTRA;//AVDISCARD_NONREF;//AVDISCARD_NONINTRA;
 
 h264_decoder_codec_ctx->time_base.num = 1;
 h264_decoder_codec_ctx->time_base.den = 30;

 h264_decoder_codec_ctx->extradata = codec_ctx->extradata;
 h264_decoder_codec_ctx->extradata_size = codec_ctx->extradata_size;
 
 int error_code = avcodec_open2(h264_decoder_codec_ctx, h264_codec, NULL);
 if (!h264_codec) {
 return -1;
 }

 if (error_code < 0)
 {
 return error_code;
 }
 decoder_context_created = true;
 }

 
 //use hardware decoding to decode video frame
 int error_code = avcodec_send_packet(h264_decoder_codec_ctx, packet);
 if(error_code == AVERROR(EAGAIN))
 {
 return AVERROR(EAGAIN);
 }
 if(error_code<0)
 {
 printf("Error: Could not send packet to video card");
 return error_code;
 }

 return 0;
}

int videocard_to_PNG(char *png_file_path, AVCodecContext* codec_ctx)
{
 if (!encoder_context_created)
 {
 //AVCodec* thumbnail_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);
 AVCodec* thumbnail_codec = avcodec_find_encoder(AV_CODEC_ID_JPEG2000);
 thumbnail_encoder_codec_ctx = avcodec_alloc_context3(thumbnail_codec);

 thumbnail_encoder_codec_ctx->width = 128;
 thumbnail_encoder_codec_ctx->height = (int)(((float)codec_ctx->height/(float)codec_ctx->width) * 128);
 thumbnail_encoder_codec_ctx->pix_fmt = AV_PIX_FMT_RGB24; //AV_PIX_FMT_YUVJ420P
 thumbnail_encoder_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;

 thumbnail_encoder_codec_ctx->time_base.num = 1;
 thumbnail_encoder_codec_ctx->time_base.den = 30;

 bool thread_check = thumbnail_encoder_codec_ctx->thread_type & FF_THREAD_FRAME;
 bool frame_threads_check = thumbnail_encoder_codec_ctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS;
 
 int error_code = avcodec_open2(thumbnail_encoder_codec_ctx, thumbnail_codec, NULL);
 if (!thumbnail_codec) {
 return -1;
 }

 if (error_code < 0)
 {
 return error_code;
 }
 encoder_context_created = true;
 }
 
 AVFrame* thumbnail_frame = av_frame_alloc();
 AVPacket* thumbnail_packet = av_packet_alloc();
 //av_init_packet(png_packet);
 int error_code = avcodec_receive_frame(h264_decoder_codec_ctx, thumbnail_frame);

 //check for errors everytime
 //note EAGAIN errors won't get here since they won't get past while
 if (error_code < 0 && error_code != AVERROR(EAGAIN))
 {
 printf("Error: Could not get frame from video card");
 return error_code;
 }
 //empty buffer if there are any more frames to pull (there shouldn't be)
 //while(error_code != AVERROR(EAGAIN))
 //{
 // //check for errors everytime
 // //note EAGAIN errors won't get here since they won't get past while
 // if (error_code < 0)
 // {
 // printf("Error: Could not get frame from video card");
 // return error_code;
 // }
 // 
 // error_code = avcodec_receive_frame(h264_decoder_codec_ctx, png_frame);
 //}

 //now we convert back to AVPacket, this time one holding PNG info, so we can store to file
 error_code = avcodec_send_frame(thumbnail_encoder_codec_ctx, thumbnail_frame);

 if (error_code >= 0) {
 error_code = avcodec_receive_packet(thumbnail_encoder_codec_ctx, thumbnail_packet);

 FILE* out_PNG;

 errno_t err = fopen_s(&out_PNG, png_file_path, "wb");
 if (err == 0) {
 fwrite(thumbnail_packet->data, thumbnail_packet->size, 1, out_PNG);
 }
 fclose(out_PNG);

 }
 return error_code;
}