mp4parser: Rotation problem when appending movies from different camera on the phone
Hi.
Maybe this has been reported before. I have this method below that merges my videos into a final mp4 file. However. When I record with the front camera first and then the back. The orientation changes. Suddenly, the movie recorded from the back is now showing upside down. The same happens when I record the backcamera and then the frontcamera.
What is the simple rotate mechanism for a video track? It doesn’t help to set orientation on video recording or the camera. It will give me the same issue.
my code
private void mergeMovies(File outFile) {
try {
int totalFilesToMerge = mMoviesToMergeList.get().size();
Movie finalMovie = new Movie();
Track[] movieTracks = new Track[totalFilesToMerge];
Track[] audioTracks = new Track[totalFilesToMerge];
for (int i = 0; i < totalFilesToMerge; i++) {
Movie movie = MovieCreator.build(mMoviesToMergeList.get().get(i).getPath());
if(movie.getTracks().get(0).getHandler().equals("vide")) {
movieTracks[i] = movie.getTracks().get(0);
}
if(movie.getTracks().get(1).getHandler().equals("soun")) {
audioTracks[i] = movie.getTracks().get(1);
}
}
finalMovie.addTrack(new AppendTrack(movieTracks));
finalMovie.addTrack(new AppendTrack(audioTracks));
FileOutputStream fos = new FileOutputStream(outFile);
BasicContainer container = (BasicContainer) new DefaultMp4Builder().build(finalMovie);
container.writeContainer(fos.getChannel());
fos.close();
} catch (IOException ie) {
Log.e("ERROR MOVIE", "Something is wrong");
}
}
About this issue
- Original URL
- State: open
- Created 9 years ago
- Reactions: 1
- Comments: 23 (2 by maintainers)
@sannies is it possible to merge 2 video recorded in different orientation by changing some lib logic or is this impossible to achieve?
Hmmm any news? This should be solved somehow since there are many developers that are using the library