
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (42)
-
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 (...) -
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 (...) -
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)
Sur d’autres sites (4627)
-
avcodec_decode_video2 RETURNS THE VALUE -1094995529 in the threaded function
2 février 2016, par WhoamiI am developing rtsp streaming player, and followed the below approach.
1) Read packet, decode, display -> works perfectly.
while (1) {
if ( av_read_frame(pFormatCtx, &packet) >= 0) {
if (packet.stream_index == videoStream) {
retDecoder = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
if ( retDecoder <= 0)
LOGD (" Unable to Decode...retval %d ", retDecoder);
if (frameFinished) {
}
}
av_free_packet (&packet);
}
}Whereas,
I introduced two threads, one is reading and pushing into the queue and the second one is reading from the queue.
My problem is while reading the same packet, and decode, i m unable to decode, the return value of the
av_video_decode2
is-1094995529
.Below is the short description of code. Kindly help to solve this issue ?.
AVPacketList *firstNode=NULL, *lastNode=NULL;
int pushPacket (AVPacket * pkt)
{
AVPacketList *newNode = av_malloc(sizeof(AVPacketList));
newNode->pkt = *pkt;
newNode->next = NULL;
SDL_LockMutex (rwMutex);
if (lastNode != NULL ) {
lastNode->next = newNode;
lastNode = newNode;
} else {
firstNode = lastNode = newNode;
}
SDL_UnlockMutex (rwMutex);
}
int pullPacket ()
{
AVPacketList *tempNode;
AVPacket *pkt;
int res=0;
SDL_LockMutex (rwMutex);
if ( firstNode != NULL ) {
tempNode = firstNode;
*pkt = tempNode->pkt;
res = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, pkt); // HERE IS THE PROBLEM.
if (frameFinished) {
LOGD (" fRAME DECODED.. %d \n", counter++);
}
if (firstNode->next != NULL) {
firstNode = firstNode->next;
}
else {
firstNode = NULL;
lastNode = NULL;
}
av_free (tempNode);
}
}In Thread 1 :
int PacketReader (void *ptr)
{
AVPacket pkt1, *rpacket;
rpacket = &pkt1;
while (globalQuit != 0) {
if ( av_read_frame(pFormatCtx, rpacket) >= 0) {
if (packet.stream_index == videoStream) {
pushPacket (rpacket);
}
av_free_packet(rpacket);
}
}
}In thread 2 :
while (1) {
pullPacket ();
} -
av_read_frame() in ffmpeg returns -5 while receiving UDP data [closed]
26 février 2024, par zttangI'm working on an app which is using ffmpeg lib. There is a living source keep sending TS stream thru udp. Then I allocated a thread use ffmpeg receive the TS packets. the code for this thread is like :


void* av_source_thread(void *data) {
 char udp_url[50];
 snprintf(udp_url, sizeof(udp_url), "udp://127.0.0.1:12345");
 AVDictionary* options = NULL;
 av_dict_set(&options, "timeout", "500000", 0); // timeout=0.5s
 av_dict_set(&options, "overrun_nonfatal", "1", 0);
 av_dict_set(&options, "fifo_size", "278876", 0); //50MB

 AVFormatContext *ffmpeg_source = avformat_alloc_context();
 while (running) {
 if (avformat_open_input(&ffmpeg_source, udp_url, NULL, &options) != 0) {
 continue;
 } else {
 break;
 }
 }
 // Some code fill codec type and alloc context here

 av_format_inject_global_side_data(ffmpeg_source);
 AVPacket *packet = av_packet_alloc();
 while (running) {
 ret = av_read_frame(ffmpeg_source, packet);
 if (ret < 0) {
 char errbuf[AV_ERROR_MAX_STRING_SIZE];
 av_strerror(ret, errbuf, AV_ERROR_MAX_STRING_SIZE);
 usleep(10000);
 log("av_read_frame failed, Exit, %s, %d", errbuf, ret);
 continue;
 }
 putPkt2Q(packet); 
 }
 av_packet_free(&packet);
 avformat_close_input(&ffmpeg_source);
 av_dict_free(&options);
 return nullptr;
}



Then the packets will be sent to Q and other thread will process them. but when I run the program, the av_read_frame will return -5(I/O error) from time to time. and once it returned -5, it can not recover unless I restart this thread.


since this is a real time source, so lost some frames are acceptable, I just want to know how to avoid this kind of issue or how to recover without restart the whole thread. I tried to increase the fifo_size in options, but it does not work.


-
avcodec_open2 returns -22 "Invalid argument" trying to encode AV_CODEC_ID_H264
26 mai 2023, par Fries of DoomI'm trying to use libavcodec to encode h264 video but avcodec_open2 returns -22 "Invalid argument" and I can't figure out why. Here is my code, which is mostly a copy from the encode example from libavcodec.


/* find the mpeg1video encoder */
 const AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_H264);
 if (!codec) {
 fprintf(stderr, "Codec '%s' not found\n", "h.264");
 exit(1);
 }

 AVCodecContext* codecContext = avcodec_alloc_context3(codec);
 if (!codecContext) {
 fprintf(stderr, "Could not allocate video codec context\n");
 exit(1);
 }

 AVPacket* pkt = av_packet_alloc();
 if (!pkt)
 exit(1);

 /* put sample parameters */
 codecContext->bit_rate = 400000;
 /* resolution must be a multiple of two */
 codecContext->width = 1920;
 codecContext->height = 1080;
 /* frames per second */
 codecContext->time_base = { 1, 25 };
 codecContext->framerate = { 25, 1 };

 /* emit one intra frame every ten frames
 * check frame pict_type before passing frame
 * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
 * then gop_size is ignored and the output of encoder
 * will always be I frame irrespective to gop_size
 */
 codecContext->gop_size = 10;
 codecContext->max_b_frames = 1;
 codecContext->codec_type = AVMEDIA_TYPE_VIDEO;
 codecContext->pix_fmt = AV_PIX_FMT_YUV420P;

 if (codec->id == AV_CODEC_ID_H264)
 av_opt_set(codecContext->priv_data, "profile", "baseline", 0);

 /* open it */
 int ret = avcodec_open2(codecContext, codec, nullptr);
 if (ret < 0) {
 char eb[AV_ERROR_MAX_STRING_SIZE];
 fprintf(stderr, "Could not open codec: %s\n", av_make_error_string(eb, AV_ERROR_MAX_STRING_SIZE, ret));
 exit(1);
 }



Does anyone know what I'm doing wrong ?