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

Playing video at slow frame rate at the end of the video. #161

Closed
sanjaykumarm opened this issue Jun 10, 2015 · 8 comments
Closed

Playing video at slow frame rate at the end of the video. #161

sanjaykumarm opened this issue Jun 10, 2015 · 8 comments
Labels

Comments

@sanjaykumarm
Copy link

Hi Samuel

I am using JavaCV 0.11 Version to create the video from the set of images stored in my device's sdcard. I am able to create the video sucessfully but the issue is that video is playing at slow frame rate(In slow motion) at the end of the vide. I am setting correct FrameRate that i am taking from the grabber class.

new Thread(new Runnable()
        {
            @Override
            public void run()
            {

                FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(outputReverseVideo, 640, 352);
                AndroidFrameConverter frameConverter = new AndroidFrameConverter();
                //recorder.setVideoCodec(5);
                recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4);
                //recorder.setFormat("3gp");
                recorder.setFormat("mp4");
                //recorder.setSampleRate(44100);
                recorder.setVideoOption("preset", "ultrafast");
                //recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
                recorder.setFrameRate(24); //Make it dynamic  using frame grabber.
                recorder.setVideoBitrate(96512); // Also make this dynamic.

                try
                {

                    long startTime = System.currentTimeMillis();
                    recorder.start();

                    for (int i = 0; i <= 3000; i++)
                    {
                        String imagePath = outputFramesFolder + "test" + i + ".png";
                        Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
                        Frame frame = frameConverter.convert(bitmap);
                        recorder.record(frame);
                        Log.d(TAG, "=====Processed=====" + i + "th Frame");
                    }
                } catch (Exception e)
                {
                    e.printStackTrace();
                } finally
                {
                    try
                    {
                        if (recorder != null)
                        {
                            recorder.stop();
                            //recorder.release();
                        }
                    } catch (FrameRecorder.Exception e)
                    {
                        e.printStackTrace();
                    }
                }
            }
        }).start();

Can you please help me in this regards?

@saudet
Copy link
Member

saudet commented Jun 13, 2015

Maybe that has something to do with your particular video player. Did you try other video players?

@sanjaykumarm
Copy link
Author

No I have checked it. Has not a problem with video player. In each player this is happening. It happens if I process first 3000 or any frames in between the total frames. Let's say I have 5000 total frames and if i process 2000 or 3000 frames to create the video then issue occurs. If I process all the frames there is no issue. I had tried it.

@saudet
Copy link
Member

saudet commented Jun 13, 2015

Could you explain in what way the number of frames is related to the frame rate?

@sanjaykumarm
Copy link
Author

I have same question. It should not be related to it. But don't know what is happening. It should not happen.

@saudet
Copy link
Member

saudet commented Jul 4, 2015

Have you tried the latest source code? It might be related to the issue fixed in this commit: fb2206d

@sanjaykumarm
Copy link
Author

Hi Samuel Audet,

I can not check it now, as i am not working on it right now. Actually that
project is dropped due to some reason.

@ShihabSoft
Copy link

Why can't you guys try using a Thread.sleep?

Regards,
ShihabSoft
Founder of RevealedTricks4U http://www.revealedtricks4u.com

@saudet
Copy link
Member

saudet commented Oct 12, 2015

Is this issue still happening with JavaCV 1.0?

@saudet
Copy link
Member

saudet commented Jan 18, 2018

Given the lack of feedback, I'm assuming this has since been fixed in FFmpeg, but please let me know if this isn't the case. Thanks!

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

No branches or pull requests

3 participants