Closed GoogleCodeExporter closed 9 years ago
Does cvFlip() do what you need?
Original comment by samuel.a...@gmail.com
on 28 Aug 2013 at 9:58
Given the lack of feedback, I'm assuming cvFlip() does the job!
Please post your questions on the mailing list next time if possible, thank you!
Original comment by samuel.a...@gmail.com
on 16 Sep 2013 at 11:33
For the delay, very apologize。
Yes, I have do the Work
Like This:
public static boolean flipMovie(String in, String out) {
boolean isSuccess = false;
// 读视频
FFmpegFrameGrabber ffmpegframegrabber = null;
// 写视频
FFmpegFrameRecorder ffmpegframerecorder = null;
try {
ffmpegframegrabber = new FFmpegFrameGrabber(in);
ffmpegframegrabber.setFormat("mp4");
ffmpegframerecorder = new FFmpegFrameRecorder(out,
ffmpegframegrabber.getImageWidth(),
ffmpegframegrabber.getImageHeight(),
ffmpegframegrabber.getAudioChannels());
ffmpegframegrabber.start();
ffmpegframerecorder.setImageWidth(ffmpegframegrabber.getImageWidth());
ffmpegframerecorder.setImageHeight(ffmpegframegrabber.getImageHeight());
// ffmpegframerecorder.setVideoCodec(13);
// ffmpegframerecorder.setFormat("mp4");
// ffmpegframerecorder.setPixelFormat(0);
// ffmpegframerecorder.setVideoBitrate(0x16e360);
// ffmpegframerecorder.setSampleRate(ffmpegframegrabber.getSampleRate());
// ffmpegframerecorder.setFrameRate(ffmpegframegrabber.getFrameRate());
ffmpegframerecorder.setFrameRate(ffmpegframegrabber.getFrameRate());
ffmpegframerecorder.setSampleRate(ffmpegframegrabber.getSampleRate());
ffmpegframerecorder.start();
// com.googlecode.javacv.Frame frame = ffmpegframegrabber.grabFrame();
com.googlecode.javacv.cpp.opencv_core.IplImage iplimage = ffmpegframegrabber.grab();
while (iplimage != null) {
Log.d("debug", "iplimage != null");
// 关键,反转
opencv_core.cvFlip(iplimage, iplimage, 1);
ffmpegframerecorder.setTimestamp(ffmpegframegrabber.getTimestamp());
ffmpegframerecorder.record(iplimage);
// ffmpegframerecorder.record(frame.samples);
//
// frame = ffmpegframegrabber.grabFrame();
//
iplimage = ffmpegframegrabber.grab();
}
isSuccess = true;
Log.d("debug", "useJar End");
} catch (Exception e) {
Log.d("debug", "useJar Exception" + e.getMessage());
e.printStackTrace();
} catch (com.googlecode.javacv.FrameRecorder.Exception e) {
Log.d("debug", "useJar Exception" + e.getMessage());
e.printStackTrace();
} finally {
// 释放资源
if(ffmpegframegrabber != null) {
try {
ffmpegframegrabber.stop();
ffmpegframegrabber.release();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 释放资源
if(ffmpegframerecorder != null) {
try {
ffmpegframerecorder.stop();
ffmpegframerecorder.release();
} catch (com.googlecode.javacv.FrameRecorder.Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return isSuccess;
}
}
Original comment by kukudete...@gmail.com
on 16 Sep 2013 at 3:16
Original issue reported on code.google.com by
kukudete...@gmail.com
on 19 Aug 2013 at 4:31