
Recherche avancée
Médias (91)
-
DJ Z-trip - Victory Lap : The Obama Mix Pt. 2
15 septembre 2011
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Matmos - Action at a Distance
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Danger Mouse & Jemini - What U Sittin’ On ? (starring Cee Lo and Tha Alkaholiks)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Cornelius - Wataridori 2
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Rapture - Sister Saviour (Blackstrobe Remix)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (54)
-
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 (...) -
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)
Sur d’autres sites (5311)
-
AVCodecContex returns zero for width and height in android
17 février 2023, par WhoamiNot sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android.



QUESTION :
Why Width and Height of the CodecContext gives me always zero ?..



int main(int argc, char *argv[])
{

 int flags;
 flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;

 if (SDL_Init (flags)) {
 LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());
 }
 else 
 LOGD (" SUCCESS: SDL_Init ");

 // ffmpeg Register all services..
 ffmpeg_register_all (); 


 pFrame = avcodec_alloc_frame ();
 context = avformat_alloc_context();

 err = avformat_open_input (&context, "rtsp:ip:port", NULL, NULL);
 if ( err < 0) {
 __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");

 return -1;
 }

 for (i = 0; i < context->nb_streams; i++)
 { 
 // Find the Decoder.
 codec = avcodec_find_decoder(context->streams[i]->codec->codec_id);
 if (codec->type == AVMEDIA_TYPE_VIDEO ) {
 __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming.. ");
 videoStreamIndex = i;

 }
 }

 // Play RTSP
 av_read_play(context);

 // Get Codec Context.
 pCodecCtx = context->streams[videoStreamIndex]->codec;
 if ( pCodecCtx == NULL )
 __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL>>> ");
 else
 __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is <<<ok>>> ");


 //Find the Decoder.
 pCodec = avcodec_find_decoder (pCodecCtx->codec_id);
 avcodec_open2 (pCodecCtx, pCodec, NULL);


 int w = pCodecCtx->width; // Why me getting 0 ? 
 int h = pCodecCtx->height;

 window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);
 // What this HIGHDPI Means ??

 if ( window != NULL ) 
 {
 LOGD (" WINDOW CREATED.. , create Renderer ..");
 renderer = SDL_CreateRenderer (window, -1, 0); 
 }
 else
 {
 LOGD (" Invalid SDL Window "); 
 }
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h); 
 return 0;
}
</ok>


-
AVCodecContex returns zero for width and height in android
7 mars 2014, par WhoamiNot sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android.
QUESTION :
Why Width and Height of the CodecContext gives me always zero ?..int main(int argc, char *argv[])
{
int flags;
flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
if (SDL_Init (flags)) {
LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());
}
else
LOGD (" SUCCESS: SDL_Init ");
// ffmpeg Register all services..
ffmpeg_register_all ();
pFrame = avcodec_alloc_frame ();
context = avformat_alloc_context();
err = avformat_open_input (&context, "rtsp:ip:port", NULL, NULL);
if ( err < 0) {
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");
return -1;
}
for (i = 0; i < context->nb_streams; i++)
{
// Find the Decoder.
codec = avcodec_find_decoder(context->streams[i]->codec->codec_id);
if (codec->type == AVMEDIA_TYPE_VIDEO ) {
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming.. ");
videoStreamIndex = i;
}
}
// Play RTSP
av_read_play(context);
// Get Codec Context.
pCodecCtx = context->streams[videoStreamIndex]->codec;
if ( pCodecCtx == NULL )
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL>>> ");
else
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is <<<ok>>> ");
//Find the Decoder.
pCodec = avcodec_find_decoder (pCodecCtx->codec_id);
avcodec_open2 (pCodecCtx, pCodec, NULL);
int w = pCodecCtx->width; // Why me getting 0 ?
int h = pCodecCtx->height;
window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);
// What this HIGHDPI Means ??
if ( window != NULL )
{
LOGD (" WINDOW CREATED.. , create Renderer ..");
renderer = SDL_CreateRenderer (window, -1, 0);
}
else
{
LOGD (" Invalid SDL Window ");
}
__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h);
return 0;
}
</ok> -
OpenCV returns an Array of All Zeros on video.read
19 janvier 2020, par Ikechukwu AnudeBelow is the relevant code
import cv2 as cv
import numpy as np
video = cv.VideoCapture(0) #tells obj to use built in camera\
#create a face cascade object
face_cascade =
cv.CascadeClassifier(r"C:\Users\xxxxxxx\AppData\Roaming\Python\Python36\site-
packages\cv2\data\haarcascade_frontalcatface.xml")
a = 1
#create loop to display a video
while True:
a = a + 1
check, frame = video.read()
print(frame)
#converts to a gray scale img
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
#create the faces
faces = face_cascade.detectMultiScale(gray, scaleFactor=1.5, minNeighbors=5)
for(x, y, w, h) in faces:
print(x, y, w, h)
#show the image
cv.imshow('capturing', gray)
key = cv.waitKey(1) #gen a new frame every 1ms
if key == ord('q'): #once you enter 'q' the loop will be exited
break
print(a) #this will print the number of frames
#captures the first frame
video.release() #end the web cam
#destroys the windows when you are not defined
cv.destroyAllWindows()The code displays a video captured from my webcam camera. Despite that, OpevCV doesn’t seem to be processing any frames as all the frames look like this
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]]which I assume means that they are empty.
This I believe is preventing the algorithm from being able to detect my face in the frame. I have a feeling that the issue lies in the ffmpeg codec, but I’m not entirely sure how to proceed even if that is the case.
OS : Windows 10
Language : PythonEDIT : The Frame is not empty but all the values in the array seem to be ’0’
Why is the frame empty and how can I get OpenCV to detect my face in the frame ?