diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index 471539f7..3a3b88e3 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -31,7 +31,7 @@ FFmpegWriter::FFmpegWriter(string path) throw (InvalidFile, InvalidFormat, Inval path(path), fmt(NULL), oc(NULL), audio_st(NULL), video_st(NULL), audio_pts(0), video_pts(0), samples(NULL), audio_outbuf(NULL), audio_outbuf_size(0), audio_input_frame_size(0), audio_input_position(0), initial_audio_input_frame_size(0), resampler(NULL), img_convert_ctx(NULL), cache_size(8), num_of_rescalers(32), - rescaler_position(0), video_codec(NULL), audio_codec(NULL), is_writing(false), write_video_count(1), write_audio_count(1) + rescaler_position(0), video_codec(NULL), audio_codec(NULL), is_writing(false), write_video_count(0), write_audio_count(0) { // Init FileInfo struct (clear all values) @@ -630,8 +630,8 @@ void FFmpegWriter::Close() } // Reset frame counters - write_video_count = 1; - write_audio_count = 1; + write_video_count = 0; + write_audio_count = 0; // Free the stream av_free(oc); diff --git a/src/Main.cpp b/src/Main.cpp index baf95dac..7e5b4453 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -149,7 +149,7 @@ int main() // openshot::FFmpegReader r("../../src/examples/piano.wav"); // openshot::FFmpegReader r("/home/jonathan/Videos/big-buck-bunny_trailer.webm"); - openshot::FFmpegReader r("/home/jonathan/Videos/sintel_trailer-1080p.mp4"); + openshot::FFmpegReader r("/home/jonathan/Desktop/test2.flv"); // openshot::FFmpegReader r("/home/jonathan/Videos/OpenShot_Now_In_3d.mp4"); // openshot::FFmpegReader r("/home/jonathan/Videos/sintel_trailer-720p.mp4"); // openshot::FFmpegReader r("/home/jonathan/Aptana Studio Workspace/OpenShotLibrary/src/examples/piano.wav"); @@ -175,15 +175,15 @@ int main() // Create a writer - FFmpegWriter w("/home/jonathan/output.mp4"); + FFmpegWriter w("/home/jonathan/output.webm"); w.DisplayInfo(); // Set options - //w.SetAudioOptions(true, "libvorbis", 44100, 2, 128000, false); - w.SetAudioOptions(true, "libmp3lame", 44100, 2, 128000, false); + w.SetAudioOptions(true, "libvorbis", 44100, 2, 128000, false); + //w.SetAudioOptions(true, "libmp3lame", 44100, 2, 128000, false); - //w.SetVideoOptions(true, "libvpx", Fraction(24,1), 320, 240, Fraction(1,1), false, false, 2000000); - w.SetVideoOptions(true, "libx264", Fraction(24,1), 320, 240, Fraction(1,1), false, false, 2000000); + w.SetVideoOptions(true, "libvpx", Fraction(24,1), 320, 240, Fraction(1,1), false, false, 2000000); + //w.SetVideoOptions(true, "libx264", Fraction(24,1), 320, 240, Fraction(1,1), false, false, 2000000); //w.SetVideoOptions(true, "libtheora", Fraction(24,1), 320, 240, Fraction(1,1), false, false, 2000000); // Prepare Streams @@ -214,7 +214,7 @@ int main() //Frame *f = r.GetFrame(1); //for (int frame = 131; frame >= 1; frame--) - for (int frame = 1; frame <= 400; frame++) + for (int frame = 1; frame <= 300; frame++) { tr1::shared_ptr f = r.GetFrame(frame); //f->AddOverlayNumber(0);