Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFmpegMediaMetadataRetriever keep scanning url in background #259

Closed
montasar8 opened this issue Jun 20, 2022 · 2 comments
Closed

FFmpegMediaMetadataRetriever keep scanning url in background #259

montasar8 opened this issue Jun 20, 2022 · 2 comments

Comments

@montasar8
Copy link

montasar8 commented Jun 20, 2022

Hi , i am using FFmpegMediaMetadataRetriever in my android app side by side with libvlc ,
my problem is after pulling info from the video url the FFmpegMediaMetadataRetriever keeps scanning the stream in the background

this is my code :

                  ((LiveActivity) getContext()).mmr.setDataSource(
                            Constants.getLiveStreamUrl(epgChannel.getStream_id()));
                    String audio = ((LiveActivity) getContext()).mmr.extractMetadata(
                            FFmpegMediaMetadataRetriever.METADATA_KEY_AUDIO_CODEC);
                    String video = ((LiveActivity) getContext()).mmr.extractMetadata(
                            FFmpegMediaMetadataRetriever.METADATA_KEY_VIDEO_CODEC);
                    String frameRate = ((LiveActivity) getContext()).mmr.extractMetadata(
                            FFmpegMediaMetadataRetriever.METADATA_KEY_FRAMERATE);
                    String width = ((LiveActivity) getContext()).mmr.extractMetadata(
                            FFmpegMediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);

                    String resolution = "HD";
                    if (Integer.parseInt(width) <= 720) {
                        resolution = "SD";
                    } else if (Integer.parseInt(width) <= 1280) {
                        resolution = "HD";
                    } else if (Integer.parseInt(width) <= 1920) {
                        resolution = "FULL HD";
                    } else if (Integer.parseInt(width) <= 3840) {
                        resolution = "ULTRA HD";
                    }
                    String finalResolution = resolution;
                    if (getContext() != null)
                        ((Activity) getContext()).runOnUiThread(() -> {
                            video_codec.setText(video);
                            audio_codec.setText(audio);
                            frame_rate.setText(frameRate + " FPS");
                            video_resolution.setText(finalResolution);
                        });
                }
            } catch (Exception e) {

                if (getContext() != null)
                    ((Activity) getContext()).runOnUiThread(() -> {
                        txt_first_epg.setText("No Information");
                        txt_second_epg.setText("No Information");
                        video_codec.setText("...");
                        audio_codec.setText("...");
                        frame_rate.setText("...");
                        video_resolution.setText("...");
                    });


                e.printStackTrace();
@wseemann
Copy link
Owner

@montasar8 This is possibly because I don't see a call to release() in your code.

@wseemann
Copy link
Owner

Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants