wseemann / FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.
1.72k stars 387 forks source link

METADATA_KEY_DURATION returns 0 for mpg file. #255

Closed pgpathan22 closed 2 years ago

pgpathan22 commented 2 years ago
val retriever = FFmpegMediaMetadataRetriever()
retriever.setDataSource(App.instance, `"path_to_mpg_file"`)
val durationMillis = retriever
            .extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION)

sample_1920x1080.zip

I have tried with other file extensions ("mp4", "avi", "mkv", "mov", "wmv", "flv", "webm", "ts") it works well but for this mpg format, it return 0. PFA, it is the video file which is causing issue.

wseemannroku commented 2 years ago

This library uses FFmpeg to retrieve the duration. I checked the file you attached and it doesn't not appear to contain the duration. Try adding this metadata to the file and you should see it returned by FFmpegMediaMetadataRetriever.

Screen Shot 2022-05-24 at 4 53 15 PM
pgpathan22 commented 2 years ago

Thanks.