[Ffmpeg-devel] [PATCH] a fix in ffmpeg.c

Limin Wang lance.lmwang
Thu Jan 18 08:34:52 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi developer,

When I decode a h264 file by using ffmpeg, it can't decode all frame as my
expect(300frame in total, it decode 180 frame only).

lmwang at laptop:~/yuvad/open/h264/ffmpeg$ ./ffmpeg -f h264 -i
/tmp/akiyo_cif.h264 /tmp/akiyo_cif.yuv
FFmpeg version SVN-r7430, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  configuration:  --enable-gpl --enable-x264
  libavutil version: 49.1.0
  libavcodec version: 51.28.0
  libavformat version: 51.7.0
  built on Jan 18 2007 15:28:56, gcc: 4.1.2 20061115 (prerelease) (Debian
  4.1.1-21)
Input #0, h264, from '/tmp/akiyo_cif.h264':
  Duration: N/A, bitrate: N/A
  Stream #0.0: Video: h264, yuv420p, 352x288, 15.00 fps(r)
File '/tmp/akiyo_cif.yuv' already exists. Overwrite ? [y/N] y
Output #0, rawvideo, to '/tmp/akiyo_cif.yuv':
  Stream #0.0: Video: rawvideo, yuv420p, 352x288, q=2-31, 200 kb/s, 15.00
  fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=  180 q=0.0 Lsize=   26730kB time=12.0 bitrate=18247.7kbits/s
video:26730kB audio:0kB global headers:0kB muxing overhead 0.000000%
lmwang at laptop:~/yuvad/open/h264/ffmpeg$   


After investigated , I found out it's caused by pts is set by default
fps(25). Below is my fix, please review it.

Thanks,
Limin


Index: ffmpeg.c
===================================================================
- --- ffmpeg.c	(revision 7430)
+++ ffmpeg.c	(working copy)
@@ -2667,6 +2667,9 @@
             frame_rate      = rfps;
             frame_rate_base = rfps_base;
 
+            /* need update stream pts info also */
+            av_set_pts_info(ic->streams[i], 64, frame_rate_base, frame_rate );
+
             enc->rate_emu = rate_emu;
             if(video_disable)
                 ic->streams[i]->discard= AVDISCARD_ALL;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQEVAwUBRa8jHEztbf7dKiuoAQIjOAf/Xkau+Uefhitb/k0lptVMNTZD5n2L91Jn
IB2uXirXgJVj7n+yxje9B8B0Vcck/SeHMQFOMopD1tDm95SSsFhK54KzdsG9U2p1
GU5MeCtsBdwjawgXKjN8YbaCbw5REwDyOApSXBM6bhLVLRJ+msPyC/bsrXfKWDgX
D5+i74f+fZ8a6qnLdqNiGGtVZjsoNgKJ1HEIUZ0XZcauzYXolpib7LyHidK3ELWg
ajm6mmdD2hY3ecrW8LFQPpUaioGR8ssEiAJgQo7D3UPOT2ES1+oYlZgSJpjDlfLj
EAhkIk/CJXWCOCaJ0lVwd9si0tIurBLixjkRoG5k5VauVFr8R3ZTrw==
=KpKN
-----END PGP SIGNATURE-----




More information about the ffmpeg-devel mailing list