Re: ffmpeg

Martin Bayer <[email protected]> Thu, 16 Jun 2005 20:31:27 +0200
Newsgroups gmane.comp.video.gephex.devel
Message-ID <[email protected]>
> [email protected]/ffmpeg--cvs--1.0--patch-7

There were again some api changes in ffmpeg. They introduced a rational
 type and changed the fields to set the frame rate. The attached patch
should fix some of the issues.

Martin

_______________________________________________
gephex-devel mailing list
[email protected]
http://lists.gephex.org/mailman/listinfo/gephex-devel
ffmpeg_api_change.patch (text/x-patch, 1.3 KB)
--- orig/modules/src/ffmpegoutmodule/ffmpegwriter.cpp
+++ mod/modules/src/ffmpegoutmodule/ffmpegwriter.cpp
@@ -210,8 +210,8 @@
     c->width = x_res;  
     c->height = y_res;
     /* frames per second */
-    c->frame_rate = 25;  
-    c->frame_rate_base = 1;
+    //    c->frame_rate = 25;  
+    //    c->frame_rate_base = 1;
     c->gop_size = 12; /* emit one intra frame every twelve frames at most */
 
     // to kick???


--- orig/modules/src/frbinmodule/ffmpegdriver.cpp
+++ mod/modules/src/frbinmodule/ffmpegdriver.cpp
@@ -276,8 +276,7 @@
 
     AVStream* video_stream = av_fc->streams[video_stream_index];
 
-    //    m_fps = ((double)enc->frame_rate) / enc->frame_rate_base;
-    m_fps = ((double)video_stream->r_frame_rate) / video_stream->r_frame_rate_base;
+    m_fps = av_q2d(video_stream->r_frame_rate);
     double duration_s;
     int ret = estimate_duration(av_fc, video_stream_index, m_fps,
                                 &duration_s, &m_start_time);
@@ -287,9 +286,7 @@
         throw std::runtime_error("Could not estimate stream duration");
       }
 
-    int num_frames = (int) 
-      floor((video_stream->r_frame_rate * duration_s) 
-            / video_stream->r_frame_rate_base);
+    int num_frames = static_cast<int>(floor(av_q2d(video_stream->r_frame_rate) * duration_s));
 
     info.width  = enc->width;
     info.height = enc->height;
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCscWGCm3i57PRsbsRAuipAJ93Ea8XkW0kpc0t2HskrZIVPenusACgkE5m
phz3NXAttQNifVFcWb4wPak=
=nOSY
-----END PGP SIGNATURE-----