AVFormatContext *format = self->video_format;
- // We will treat everything with the producer fps.
- // TODO: make this more flexible.
- double fps = mlt_profile_fps( profile );
-
// Get the duration
if ( !mlt_properties_get_int( properties, "_length_computed" ) )
{
if ( format->duration != AV_NOPTS_VALUE )
{
// This isn't going to be accurate for all formats
- mlt_position frames = ( mlt_position )( ( ( double )format->duration / ( double )AV_TIME_BASE ) * fps );
+ // We will treat everything with the producer fps.
+ mlt_position frames = ( mlt_position )( int )( format->duration *
+ profile->frame_rate_num / profile->frame_rate_den / AV_TIME_BASE);
mlt_properties_set_position( properties, "out", frames - 1 );
mlt_properties_set_position( properties, "length", frames );
mlt_properties_set_int( properties, "_length_computed", 1 );