Note that there are some explanatory texts on larger screens.

plurals
  1. POMerging 2 videos using JavaCV, second video has no sound
    primarykey
    data
    text
    <p>This is the code I use:</p> <pre><code>public void stopRecording() throws Exception, com.googlecode.javacv.FrameRecorder.Exception { runAudioThread = false; if (recorder != null &amp;&amp; recording) { recording = false; Log.v(LOG_TAG, "Finishing recording, calling stop and release on recorder"); try { recorder.stop(); recorder.release(); } catch (FFmpegFrameRecorder.Exception e) { e.printStackTrace(); } } Log.i(LOG_TAG, "filename = " + ffmpeg_link); if (i &gt; 0) { Log.i(LOG_TAG, "!!!!!!!!!WILL CONCATENATE"); FrameGrabber grabber1 = new FFmpegFrameGrabber(pathStart + "/JavaCV/stream0.mp4"); grabber1.start(); Log.i(LOG_TAG, "graber1.start"); FrameGrabber grabber2 = new FFmpegFrameGrabber(pathStart + "/JavaCV/stream1.mp4"); grabber2.start(); Log.i(LOG_TAG, "graber2.start"); FrameRecorder recorder2 = new FFmpegFrameRecorder(pathStart + "/JavaCV/output.mp4", grabber1.getImageWidth(), grabber1.getImageHeight(), grabber1.getAudioChannels()); recorder2.setFrameRate(grabber1.getFrameRate()); recorder2.setSampleFormat(grabber1.getSampleFormat()); recorder2.setSampleRate(grabber1.getSampleRate()); Log.i(LOG_TAG, "Recorder.start"); recorder2.start(); Frame frame; int j = 0; while ((frame = grabber1.grabFrame()) != null) { j++; recorder2.record(frame); Log.i(LOG_TAG, "while1 nr:" + j + "Frame number: " + grabber1.getFrameNumber()); } Log.i(LOG_TAG, "after while1"); while ((frame = grabber2.grabFrame()) != null) { recorder2.record(frame); Log.i(LOG_TAG, "while2"); } Log.i(LOG_TAG, "Recorder.stop"); recorder2.stop(); grabber2.stop(); grabber1.stop(); Log.i(LOG_TAG, "end concatenate"); } i++; ffmpeg_link = pathStart + "/JavaCV/stream" + i + ".mp4"; Log.i(LOG_TAG, "next filename = " + ffmpeg_link); } </code></pre> <p>It works great, it manages to merge the videos, the only issue I have is that it does not have sound for the second video. How can i put the audiochannel on the second video also?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload