<p dir="ltr">On Aug 23, 2013 5:18 PM, "Pradeep Karosiya" <<a href="mailto:praks411@gmail.com">praks411@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I'm working on application which uses both ffmpeg and ffms (wrapper on<br>
> ffmpeg) for decoding video file.<br>
> The decoding audio and video is then played on user interface.<br>
> For low resolution video till 640x360p both audio and video works fine and<br>
> frame rate is maintained as per source file.<br>
> However when video frame size increases 1280x720p, I'm not able to achieve<br>
> desire frame rate and since audio is synchronized to video, audio quality is<br>
> decreasing which lots of breaks.<br>
> After analyzing the timings of critical function in my filter chain I found<br>
> that, though av_read_frame and avcodec_decode_video2 takes almost same time<br>
> for both 640x360 and 1280x720, there is considerable difference for<br>
> sws_scale() function.<br>
> Please someone suggest is there a way to reduce computation time of<br>
> sws_scale.<br>
> Audio decoding is taking constant time for both 640x360p and 1280x720p<br>
> video. Though I'm working to further reduce its timing.<br>
><br>
> Also if someone has some other ideas on how to reduce overall time, to<br>
> achieve desire frame rate without compromising on audio quality please let<br>
> me know.<br>
><br>
> Thanks and Regards,<br>
> Pradeep</p>
<p dir="ltr">I would suggest to use audio as the yardstick and synchronize video playback accordingly, not the other way round.</p>
<p dir="ltr">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.</p>
<p dir="ltr">As for optimizations, please describe what hardware you are using, this may have a serious influence on the expected max performance.</p>
<p dir="ltr">BR<br>
Alex</p>