On Fri, Dec 17, 2010 at 9:55 AM, Tomas Härdin <[email protected]>wrote:
> On Thu, 2010-12-16 at 14:57 -0800, Pushkar Pradhan wrote: > > On Thu, Dec 16, 2010 at 2:44 PM, Eli Konky <[email protected]> wrote: > > > > > Thanks. > > > > > > I know the delay because the module that produced the video can report > the > > > delay. > > > In some cases I'll use a human (maybe with vlc player that has a > > > compensation feature) > > > > > > Can I please ask you for a direction on how to rewrite pts? can I use > > > ffmpeg > > > to do that? > > > > > > Thanks > > > Eli > > > > > > On Fri, Dec 17, 2010 at 12:38 AM, Pushkar Pradhan < > > > [email protected] > > > > wrote: > > > > > > > On Thu, Dec 16, 2010 at 9:44 AM, Eli Konky <[email protected]> > wrote: > > > > > > > > > Hi, > > > > > > > > > > I have an mp4 (h.264, aac) file where the audio is lagging behind > the > > > > > video. > > > > > > > > > > Is it possible to fix this file by just rewriting pts somehow, > without > > > > > decoding and re-encoding the entire file? > > > > > Is there any other way to deal with this? > > > > > > > > > > Thanks > > > > > Eli > > > > > _______________________________________________ > > > > > libav-user mailing list > > > > > [email protected] > > > > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > > > > > > > > > > > > You can rewrite the pts without doing any decoding/encoding. But how > do > > > you > > > > know what is the correct adjustment? You can do trial and error, e.g. > add > > > > +50 msec, 100 msec and check the result visually. But what if the lag > is > > > > varying over time? > > > > > > > > -- > > > > pushkar > > > > _______________________________________________ > > > > libav-user mailing list > > > > [email protected] > > > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > > > > > > _______________________________________________ > > > libav-user mailing list > > > [email protected] > > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > > > > > > As you read the frames (in AVPacket I believe) you can write it out by > > modifying the AVPacket.pts value. I don't have much experience coding > with > > libavcodec so please look at the examples. You can probably use ffmpeg > too, > > you will have to scan through the many CLI options it provides. > > By the way, please do not top post mailing list users do not like it :-) > > I don't think ffmpeg has an option for adjusting the timestamps of the > streams. It shouldn't be too hard to hack one in though. > > Look at how the options are specified, then look at the logic for > -vcodec copy (or -acodec copy). Whenever you get a packet you add > av_rescale_q(us_adjust, AV_TIME_BASE_Q, ist->time_base) to both > timestamps (unless they're AV_NOPTS_VALUE). us_value is your adjustment > in microseconds (aka AV_TIME_BASE). > > /Tomas > > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > Thanks. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
