
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (80)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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 ;
-
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 (...) -
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 (14624)
-
swscale/swscale_unscaled : add more unscaled planar RGB to planar RGB coverage
5 novembre 2024, par James Almer -
swscale/swscale_unscaled : add unscaled hbd planar RGB to x2rgb10le
31 octobre 2024, par James Almer -
Packet (AV_PIX_FMT_UYVY422) to Planar (AV_PIX_FMT_YUVJ422P) format conversion
25 août 2017, par user3743908My image format is "YUV422_8_UYVY" which is packed AV_PIX_FMT_UYVY422 format, i am trying to convert it in Planar "AV_PIX_FMT_YUVJ422P", but not able to succeed yet, below is the code on which i am working.
error message : [swscaler @ 004b3fa0] deprecetd pixel format used, make sure you did set range correctly
resultant image (file ) having 0 k size
what would be the last argument of av_image_alloc() for conversion like 16,32 etc
my aim to convert packet yuv image in planar yuv format
static AVCodecContext *pCodecCtx;
static AVFormatContext *pFormatCtx;
static AVCodec *pCodec;
static AVOutputFormat* fmt;
static AVFrame *RawPic;
static AVFrame *ScalePic;
static AVPacket pkt;
static AVStream* video_st;
static FILE *file;
static struct SwsContext *sws_ctx;
enum AVPixelFormat src_pix_fmt = AV_PIX_FMT_UYVY422;
enum AVPixelFormat dst_pix_fmt = AV_PIX_FMT_YUVJ422P;
int main( ) {
FILE *in_file = NULL; //packed Source
FILE *out_file = NULL; //planar output
int in_width = 2448; //YUV's width
int in_height = 2050; //YUV's heigh
int out_width = 2448; //YUV's width
int out_height = 2050; //YUV's heigh
unsigned long int ret;
in_file = fopen("c:\\yuv422_8_uyvy.yuv","rb"); //Source Input File
if(in_file == NULL) { printf("\n\tinput File Opening error...!!"); exit(1); }
out_file = fopen("d:\\test_Planar.yuv", "wb"); //Source Input File
if(out_file == NULL) { printf("\n\toutput File Opening error...!!"); exit(1); }
else { printf("\n\tOutput File Created...!!"); }
//------Loads the whole database of available codecs and formats------
av_register_all();
printf("\t\n\tCodac database Loaded...\n");
//------Contex Variable assignment--------------------------------
pFormatCtx = avformat_alloc_context();
fmt = NULL;
fmt = av_guess_format("mjpeg",NULL,NULL);
pFormatCtx->oformat = fmt;
video_st = avformat_new_stream(pFormatCtx, 0); if (video_st==NULL) return -1;
pCodecCtx = video_st->codec;
pCodecCtx->codec_id = fmt->video_codec;
pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
pCodecCtx->pix_fmt = src_pix_fmt;
printf("\t\n\tContex Variable assigned...\n");
//------Allocate Source Image Buffer--------------------------------
AVFrame *RawPic = av_frame_alloc();
if(!RawPic) { printf("\nCould not allocate Raw Image frame\n"); exit(1);}
RawPic->format = pCodecCtx->pix_fmt;
RawPic->width = in_width;
RawPic->height = in_height;
ret = av_image_alloc(RawPic->data,RawPic->linesize,in_width,in_height,src_pix_fmt, 16);
if(ret < 0) { printf("\nCould not allocate raw picture buffer\n"); exit(1);}
printf("\n\tAllocate Source Image Buffer");
//------Allocate Desitnation Image Buffer-------------------
AVFrame *ScalePic = av_frame_alloc();
if(!ScalePic) { printf("\nCould not allocate Scale Image frame\n"); exit(1);}
ScalePic->format = pCodecCtx->pix_fmt;
ScalePic->width = out_width;
ScalePic->height = out_height;
ret = av_image_alloc(ScalePic->data,ScalePic->linesize,out_width,out_height,dst_pix_fmt, 32);
if(ret < 0) { printf("\nCould not allocate Scale picture buffer\n"); exit(1);}
dst_bufsize = ret;
printf("\n\tAllocate Destination Image Buffer");
//------Create scaling context------------------------------sws_getContex
printf("\t\n\tCreating Scaling context..[sws_getContext]\n");
sws_ctx = sws_getContext( in_width, in_height, src_pix_fmt,
out_width, out_height, dst_pix_fmt,
SWS_BICUBIC, NULL, NULL, NULL);
if(!sws_ctx) { printf("\nContext Error..\n"); }
printf("\t\n\tScaling context...Created\n");
//------Create scaling context---OR CONVERTED TO DESTINATION FORMAT--
sws_scale(sws_ctx, RawPic->data, RawPic->linesize, 0, in_height, ScalePic->data, ScalePic->linesize);
printf("\t\n\tCreating Scaling context...sws_scale...done\n");
int num_bytes = avpicture_get_size(src_pix_fmt,in_width,in_height);
uint8_t* ScalePic_Buffer = (uint8_t *)av_malloc(num_bytes*sizeof(int8_t));
avpicture_fill((AVPicture*)ScalePic,ScalePic_Buffer,AV_PIX_FMT_YUVJ422P,out_width,out_height);
//-----Write Scale Image to outputfile----------------------------
fwrite(ScalePic->data,1,dst_bufsize,out_file);
//---Release all memory and close file----------------------------------
fclose(in_file);
fclose(out_file);
avcodec_close(pCodecCtx);
av_free(pCodecCtx);
av_freep(&RawPic->data[0]);
av_frame_free(&RawPic);
av_freep(&ScalePic->data[0]);
av_frame_free(&ScalePic);
av_frame_free(&RawPic);
printf("\n\n");
system("PAUSE");
exit(1);
}