[Libav-user] Clip audio file with specified time range!

Emmanuel HOUITTE ehouitte at yacast.fr
Fri Mar 8 08:14:44 CET 2013


You need to use AVStream:time_base 
double dNbSeconds = (double)(pAVPacket->dts - pAVStream->first_dts) * pAVStream->time_base.num / pAVStream->time_base.den;

-----Message d'origine-----
De : libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] De la part de thanh nhan thanh nhan
Envoyé : vendredi 8 mars 2013 04:00
À : libav-user at ffmpeg.org
Objet : [Libav-user] Clip audio file with specified time range!

Hi all,
Does anyone know how to clip audio file with specified time range in second ( like int star_time, end_time) using ffmpeg functions.
My current status is I am running a while loop:
while (av_read_frame(formatContext, &packet) == 0)
   int frameFinished = 0;
   avcodec_decode_audio4(codecContext, frame, &frameFinished, &packet);
   // do somthing
I found some fields in AVStream and AVFrame that introduce time-base, time-stamp... but i don't clearly what they mean. How can i translate those kinds of time in to real time unit( second or milisecond) Thanks in advance!
Libav-user mailing list
Libav-user at ffmpeg.org

More information about the Libav-user mailing list