Hello,
The subject speaks for itself. I'm trying to retrieve the video
information (actually I would be happy getting the duration :P).
This is what I'm doing:
AVFormatContext *pFormatCtx;
//AVCodecContext *pCodecCtx;
for(int j=0; j < listaDeVideos.size(); j++){
// Open video file
if(av_open_input_file(&pFormatCtx, ((QString)
listaDeVideos.at(j)).toLocal8Bit(), NULL, 0, NULL)!=0)
qDebug()<< "Couldn't open file";
int i;
dump_format(pFormatCtx, 0, ((QString)
listaDeVideos.at(j)).toLocal8Bit(), 0);
// Find the first video stream
int videoStream=-1;
for(i=0; i<pFormatCtx->nb_streams; i++)
if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) {
videoStream=i;
break;
}
if(videoStream==-1)
qDebug() << "Didn't find a video stream";
else
qDebug() << pFormatCtx->streams[videoStream]->duration;
// Get a pointer to the codec context for the video stream
// pCodecCtx=pFormatCtx->streams[videoStream]->codec; //Para
checar no futuro se o codec é valido
}
I'm using the "dump_format" to see what it retrieves:
Input #0, mpeg, from '5_vide_a_gente_apresenta.mpg':
Duration: N/A
N/A, bitrate:
, bitrate: N/A
N/A
But using the command "ffmpeg -i 5_vide_a_gente_apresenta.mpg":
Input #0, mpeg, from '5_vide_a_gente_apresenta.mpg':
Duration: 00:01:00.40, start: 0.253367, bitrate: 19192 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 1440x1080 [PAR 4:3
DAR 16:9], 18500 kb/s, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
What am I doing wrong?
Thanks,
Leonardo
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user