[mythtv] [PATCH] Missing keyframes on mpeg4 transcode

Jay Merrifield fracmak at gmail.com
Sun Feb 27 12:40:16 UTC 2005


Ever since upgrading to .17, I've been having problems transcoding
RTJpeg files into mpeg4. The video is transcoded just fine, but the
seek table always seems to be screwed up to some degree or another. So
I finally got the time to tear through the code and what follows is a
summary of what I found, and how I fixed it (more like how I found the
change in CVS that broke my setup and backed it out). Hopefully this
will be useful for others. Investigation into broken files found that
all files had a perfectly normal/uncorrupt header/seek table but no
keyframes were being stored. Upon checking the transcoding process,
NuppelVideoRecorder was never executive the code to write keyframes.
Further investigation found that inside nuppeldecoder.cpp, keyframes
were being decoded correctly, but the isLastFrameKey() function was
always returning false. Appears lastKey and framesPlayed were always
off by 1 frame, so the keyframes were never being sent to the
NuppelVideoRecorder. Subsequent patch to correct this problem lead me
to the CVS change log and where the original change that broke my
system was made. Revision 1.54 commented out some frame adjustment
code in favor of alternate frame tracking code. This change broke
transcoding on my system. Here's the diff -u with the latest CVS and
the changes I made: The second change in the diff -u was done in the
hopes of not breaking the original patch.

Jay

RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/nuppeldecoder.cpp,v
retrieving revision 1.64
diff -u -r1.64 nuppeldecoder.cpp
--- libmythtv/nuppeldecoder.cpp 23 Feb 2005 05:04:36 -0000      1.64
+++ libmythtv/nuppeldecoder.cpp 27 Feb 2005 12:24:40 -0000
@@ -957,7 +957,7 @@
                 VERBOSE(VB_AUDIO, QString("Video timecode = %1")
                         .arg(frameheader.timecode));
                 lastKey = frameheader.timecode;
-                //framesPlayed = frameheader.timecode - 1;
+                framesPlayed = frameheader.timecode - 1;

                 if (!hasFullPositionMap)
                 {
@@ -1021,7 +1021,7 @@
                 continue;
             }

-            buf->frameNumber = framesPlayed;
+            buf->frameNumber = framesPlayed + 1;
             m_parent->ReleaseNextVideoFrame(buf, frameheader.timecode);
             gotvideo = 1;
             if (getrawframes && getrawvideo)


More information about the mythtv-dev mailing list