[Libav-user] Transcoding Decoding_Encoding to MP4/h264 - asynchron tracks
marco_sie at web.de
Tue Feb 11 14:11:05 CET 2014
i'm new to AvCodec Libs and .. to this Mailist System, pls be gentle :)
Where to start... first i have a lot of Questions .... and i could fill a
Book with it (with no answers of course).
I developed a transcoder with libav... for Mac/Windows, lets Focus for Mac
It works and i'm happy i got so far already... but i faceing a Problem with
async Video and Audio Tracks...
If the Clip is really long then it gets really bad, People who Speaking
(Mouth movement) doesn't match with the words. (I saw Drangers tutorial...
but it was for video playing?)
I think it has to do something with the time_base,pts,dts,.... and because
i'm new i don't get it at all.
And i read a lot about dropped Frames... in ffmpeg.c there get frames
Is there some A-Z or Step by Step Guide out there.. if i would understand
this fully i would create one... because i'm really good in forgetting...
Because the whole transcoding Code is long... i just write pseudo code, that
you can get a glimpse...
Transcoding Target: xxx Format to mp4 - h264/AAC ( for iPad,Web)
*Pseudecode My Transcoding*
if (av_read_frame() == ok)
if (audio_stream == ok)
if (decode_audio == ok)
else if (video_stream == ok)
if (decode_video == ok)
Before Encoding i set the pts to my frame counter(i saw it some examples)
newScaledFrame->pts = decodedVFrameCounter; //decodedVideoFrame, which get
newSampledFrame->pts = decodedAFrameCounter; //decodedAudioFrame, which get
The Code for PTS/DTS after Encoding (for both audio and video):
if (encoderPacketV.pts != AV_NOPTS_VALUE)
encoderPacketV.pts = av_rescale_q(encoderPacketV.pts,
if (encoderPacketV.dts != AV_NOPTS_VALUE)
encoderPacketV.dts = av_rescale_q(encoderPacketV.dts,
if (encoderPacketV.duration > 0)
encoderPacketV.duration = av_rescale_q(encoderPacketV.duration,
I already watched in ffmpeg.c and handbrake Code... and what i see that they
do a lot more about pts/dts and i confused me :(
There are still some other things.. like 2 frames missing at the start
(bytes but no got_picts/finishedFrame from video_decode2).
But let this aside.. the major thing is the async tracks of the video file.
If you require more information let see how i can provide it.
I hope somebody can help me.
View this message in context: http://libav-users.943685.n4.nabble.com/Transcoding-Decoding-Encoding-to-MP4-h264-asynchron-tracks-tp4659230.html
Sent from the libav-users mailing list archive at Nabble.com.
More information about the Libav-user