android-gpuimage-plus icon indicating copy to clipboard operation
android-gpuimage-plus copied to clipboard

How to Pause & Resume recording

Open deepakrokz opened this issue 7 years ago • 12 comments

Hi @wysaid I have tried to pause and resume video recording with the specified button "Pause", "Resume" but it doesn't seem to be working. I have checked issues regarding this #114 #199 Please help me out of this

Thanks in advance!

deepakrokz avatar Feb 02 '18 10:02 deepakrokz

You can save the video clips and convert them into one video at last.

wysaid avatar Feb 02 '18 10:02 wysaid

Is there any other way ... because if we are going to merge separate recordings through ffmpeg, it's taking too much time... can you suggest a solution.

deepakrokz avatar Feb 02 '18 10:02 deepakrokz

Maybe you should modify the c++ code, and handle the pause function. The PTS value represents the current frame index. You can just make it frozen when you paused recording.

wysaid avatar Feb 05 '18 06:02 wysaid

Okay let me try...Thanks for your time

deepakrokz avatar Feb 05 '18 13:02 deepakrokz

Hi @wysaid, Please implement pause & resume functionality during video recording. I am stuck without theses. Please help. I will be very thankful to you..

deepakrokz avatar Mar 19 '18 09:03 deepakrokz

I am currently using an alternative for merging recorded videos. I use Mp4Parser (https://github.com/sannies/mp4parser), which merges multiple clips to one mp4 video almost instantly. Just be careful that all the clips you try to merge are of the same resolution and frame rates.

tsoumalis avatar Mar 19 '18 20:03 tsoumalis

Thanks for the suggestion and solution

Can you give me a working example? Because the mp4parser sample is not properly formatted, I am trying this example

File sdCard = Environment.getExternalStorageDirectory(); for (int i = 0; i < 100; i++) { try { FileInputStream fileInputStream = new FileInputStream(new File(sdCard, "Movies/urndeceapidIMDBtt04721814LKQIvbjJF72ODtC.uvu")); IsoFile isoFile = new IsoFile(fileInputStream.getChannel()); //isoFile = new IsoFile(Channels.newChannel(new FileInputStream(this.filePath))); //Path path = new Path(isoFile); XmlBox xmlBox = (XmlBox) Path.getPath(isoFile, "/moov/meta/xml "); String xml = xmlBox.getXml(); //System.err.println(xml; } catch (IOException e) { } }

Giving this error

Error:(119, 35) error: no suitable constructor found for IsoFile(FileChannel) constructor IsoFile.IsoFile(String) is not applicable (argument mismatch; FileChannel cannot be converted to String) constructor IsoFile.IsoFile(DataSource) is not applicable (argument mismatch; FileChannel cannot be converted to DataSource)

deepakrokz avatar Mar 20 '18 08:03 deepakrokz

Hi @tsoumalis , I am eagerly waiting for your response.

deepakrokz avatar Mar 20 '18 10:03 deepakrokz

I use the following code:

List<Movie> inMovies = new LinkedList<Movie>();
            for(int i = 0; i < files.size(); i++) {
                if (!files.get(i).exists())
                    continue;
                Movie movie = MovieCreator.build(files.get(i).getAbsolutePath());
                inMovies.add(movie);
            }

            List<Track> videoTracks = new LinkedList<Track>();
            List<Track> audioTracks = new LinkedList<Track>();
            for (Movie m : inMovies) {
                for (Track t : m.getTracks()) {
                    if (t.getHandler().equals("soun")) {
                        audioTracks.add(t);
                    }
                    if (t.getHandler().equals("vide")) {
                        videoTracks.add(t);
                    }
                }
            }
            Movie result = new Movie();
            if (audioTracks.size() > 0) {
                result.addTrack(new AppendTrack(audioTracks.toArray(new Track[audioTracks.size()])));
            }
            if (videoTracks.size() > 0) {
                result.addTrack(new AppendTrack(videoTracks.toArray(new Track[videoTracks.size()])));
            }
            Container out = new DefaultMp4Builder().build(result);
            String outputFilePath = Utilities.GetPath("output_append.mp4"); // Replace with the path of your output video
            FileOutputStream fos = new FileOutputStream(new File(outputFilePath));
            out.writeContainer(fos.getChannel());
            fos.close();

The files variable is a List<File> of recorded mp4 video files

tsoumalis avatar Mar 20 '18 15:03 tsoumalis

Thank you so much, let me try this.

deepakrokz avatar Mar 22 '18 06:03 deepakrokz

Thank you so much it worked really fast, that's unexpected. Thank you so much once again

deepakrokz avatar Mar 22 '18 06:03 deepakrokz

I'm doing the same but for me audio and video is not syn after merge(with mp4 parser) from the 2nd clip. Any suggestion @tsoumalis

Sp4Rx avatar May 02 '19 09:05 Sp4Rx