
Recherche avancée
Autres articles (62)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (6528)
-
lavc/vaapi_encode : Add hardware config metadata
13 avril 2020, par Mark Thompsonlavc/vaapi_encode : Add hardware config metadata
These encoders all accept VAAPI surfaces in a hardware frames context.
-
The hardware decoding was successful, but the hw_frames_ctx in the received frame is empty
15 juillet 2024, par mercuric taylorI tried to use QSV hardware decoding under ffmpeg, using the integrated graphics 730 on my computer. Here's the code I used to initialize the decoder


const AVCodec* codec = NULL;
int ret;
int err = 0;
// Create the QSV hardware device.
 ret = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_QSV, "auto", NULL, 0);
 if (ret < 0)
 {
 char error_string[AV_ERROR_MAX_STRING_SIZE];
 av_make_error_string(error_string, AV_ERROR_MAX_STRING_SIZE, ret);
 LError("Error creating QSV device: {}", error_string);
 return NULL;
 }
 // Search for QSV decoders, either for H.264 or H.265.
 codec = avcodec_find_decoder_by_name(codec_name);
 if (!codec)
 {
 LError("Failed to find QSV decoder.");
 return NULL;
 }

 // Creating a decoder context and associating it with the hardware device.
 decoder_ctx = avcodec_alloc_context3(codec);
 if (!decoder_ctx)
 {
 ret = AVERROR(ENOMEM);
 LError("Failed to allocate decoder context.\n");
 return NULL;
 }
 decoder_ctx->codec_id = AV_CODEC_ID_H264; 
 decoder_ctx->opaque = &hw_device_ctx;
 decoder_ctx->get_format = get_format;
// Open the decoder.
 if ((ret = avcodec_open2(decoder_ctx, NULL, NULL)) < 0)
 {
 LError("Failed to open decoder: %d\n", ret);
 return NULL;
 }

 parser_ctx = av_parser_init(avcodec_find_encoder_by_name(codec_name)->id);



The following is the process of decoding using the decoder :


AVFrame* frame = av_frame_alloc();
 AVFrame* dstFrame = av_frame_alloc();
 res = avcodec_send_packet(decoder_ctx, pkt);
 if (res < 0)
 {
 return;
 }
 int num = 0;
 while (res >= 0)
 {
 res = avcodec_receive_frame(decoder_ctx, frame);

 if (res == AVERROR(EAGAIN) || res == AVERROR_EOF)
 {
 //if (res == AVERROR(EAGAIN)) 
 //{
 // LInfo("AVERROR(EAGAIN):");
 //}
 //if (res == AVERROR_EOF) 
 //{
 // // LInfo("AVERROR_EOF");
 //}
 // av_frame_unref(frame);
 break;
 }
 else if (res < 0)
 {
 // av_frame_unref(frame);
 return;
 }


 frameNumbers_++;
 if (frame->hw_frames_ctx == NULL)
 {
 LError("hw_frames_ctx is null");
 LError("avcodec_receive_frame return is {}", res);
 }



My issue is that I've successfully decoded the video. The return value of avcodec_receive_frame is 0, and the width and height of the AVFrame are the same as the input video stream.


However,** the hw_frames_ctx field of the AVFrame is empty**. Why would this happen in a successful hardware decoding scenario ?


Could it be due to some incorrect configurations ? I've set up a get_format function like this


static enum AVPixelFormat get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts)
{
 while (*pix_fmts != AV_PIX_FMT_NONE) {
 if (*pix_fmts == AV_PIX_FMT_QSV) {
 DecodeContext *decode = (DecodeContext*)avctx->opaque;
 AVHWFramesContext *frames_ctx;
 AVQSVFramesContext *frames_hwctx;
 int ret;
 /* create a pool of surfaces to be used by the decoder */
 avctx->hw_frames_ctx = av_hwframe_ctx_alloc(decode->hw_device_ref);
 if (!avctx->hw_frames_ctx)
 return AV_PIX_FMT_NONE;
 frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
 frames_hwctx = (AVQSVFramesContext*)frames_ctx->hwctx;
 frames_ctx->format = AV_PIX_FMT_QSV;
 frames_ctx->sw_format = avctx->sw_pix_fmt;
 frames_ctx->width = FFALIGN(avctx->coded_width, 32);
 frames_ctx->height = FFALIGN(avctx->coded_height, 32);
 frames_ctx->initial_pool_size = 32;
 frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
 ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
 if (ret < 0)
 return AV_PIX_FMT_NONE;
 return AV_PIX_FMT_QSV;
 }
 pix_fmts++;
 }
 fprintf(stderr, "The QSV pixel format not offered in get_format()\n");
 return AV_PIX_FMT_NONE;
}



But I also noticed that even though I set decoder_ctx->get_format = get_format ; this function is not being executed later on.


I observed that my GPU is also being utilized during program execution, indicating a successful hardware decoding. My subsequent goal is to render a frame from this decoded AVFrame. It seems like the hw_frames_ctx of the AVFrame is a texture handle on the GPU. I wish to directly use this field for D3D11 rendering and display it on the screen.
My questions are :


- 

- Is the hw_frames_ctx field empty in the case of successful hardware decoding ?
- Does it represent a texture handle on the GPU ?
- If my rendering approach is wrong, how can I correctly render this AVFrame using D3D11 ?








-
Anomalie #4424 (Fermé) : Une rubrique est considérée comme publiée si elle a un logo
19 janvier 2020, par nicod _Une rubrique sans article passe au statut "publie" dès qu’on lui ajoute un logo (qui sont maintenant des documents).
Je pense que c’est à la fois côté SPIP, qui compte tous les enfants d’une rubrique, et du côté du plugin médias, qui renvoie le nombre de documents d’une rubrique qu’il faut intervenir.
Mais medias_objet_compte_enfants() renvoie juste un total (sql_countsel), du coup il faudrait peut être lui passer un paramètre pour qu’elle exclue les logos dans certains cas ?