[Libav-user] Frame decoding and sw_scale timings for HD video

Alex Cohn alexcohn at netvision.net.il
Sat Aug 24 00:12:03 CEST 2013

On Aug 23, 2013 5:18 PM, "Pradeep Karosiya" <praks411 at gmail.com> wrote:
> Hi,
> I'm working on application which uses both ffmpeg and ffms (wrapper on
> ffmpeg) for decoding video file.
> The decoding audio and video is then played on user interface.
> For low resolution video till 640x360p both audio and video works fine and
> frame rate is maintained as per source file.
> However when video frame size increases 1280x720p, I'm not able to achieve
> desire frame rate and since audio is synchronized to video, audio quality
> decreasing which lots of breaks.
> After analyzing the timings of critical function in my filter chain I
> that, though av_read_frame and avcodec_decode_video2 takes almost same
> for both 640x360 and 1280x720, there is considerable difference for
> sws_scale() function.
> Please someone suggest is there a way to reduce computation time of
> sws_scale.
> Audio decoding is taking constant time for both 640x360p and 1280x720p
> video. Though I'm working to further reduce its timing.
> Also if someone has some other ideas on how to reduce overall time, to
> achieve desire frame rate without compromising on audio quality please let
> me know.
> Thanks and Regards,
> Pradeep

I would suggest to use audio as the yardstick and synchronize video
playback accordingly, not the other way round.

This may sometimes lead to decision to drop a video frame to compensate for
delay caused by CPU throughput. You can skip sws_scale for frames that will
not be displayed. It's possible that reducing the frame rendering rate from
30 to 25 FPS will allow to keep video stream at pace with audio, with
insignificant effect on himan percrption.

As for optimizations, please describe what hardware you are using,  this
may have a serious influence on the expected max performance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130824/89843a26/attachment.html>

More information about the Libav-user mailing list