[mythtv] [PATCH] Allow disabling video copy in mythtranscode

Jason Parekh jasonparekh at gmail.com
Sat Jul 17 14:18:42 EDT 2004


Hello,

I am recording at higher bitrate lower quality MPEG4 however I'd like
to transcode eventually to lower bitrate higher quality MPEG4.

The problem is, mythtranscode compares the source and target codec
types (ie: MPEG4, RTjpeg, etc.) and if they are equal, it will just
copy over the video rather than re-encode.

I have submitted a patch that will let one pass a -n (or
--novideocopy) parameter which will disable this video copy.  The
default behavior is to allow video copying like the program did
before.

Maybe I will create a more proper patch that compares the source and
target codec settings and ONLY if those differ it will disable the
video copy.

Patched against 0.15.1

Hope this helps,
Jason
-------------- next part --------------
Index: mythtv/programs/mythtranscode/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythtranscode/main.cpp,v
retrieving revision 1.17
diff -u -r1.17 main.cpp
--- mythtv/programs/mythtranscode/main.cpp	23 Jan 2004 06:01:17 -0000	1.17
+++ mythtv/programs/mythtranscode/main.cpp	17 Jul 2004 18:10:27 -0000
@@ -44,6 +44,8 @@
     cerr << "\t--buildindex   or -b: Build a new keyframe index\n";
     cerr << "\t\t(use only if audio and video fifos are read independantly)\n";
     cerr << "\t--help         or -h: Prints this help statement.\n";
+    cerr << "\t--nocopyvideo  or -n: Will not copy video even if using the\n";
+    cerr << "\t                      codec as source and destination.\n";
 }
 
 int main(int argc, char *argv[])
@@ -55,6 +57,8 @@
     bool build_index = false, fifosync = false;
     QMap<long long, int> deleteMap;
     QMap<long long, long long> posMap;
+    bool noCopyVideo = false;
+
     srand(time(NULL));
 
     QApplication a(argc, argv, false);
@@ -194,6 +198,11 @@
             usage(a.argv()[0]);
             return(0);
         }
+        else if (!strcmp(a.argv()[argpos],"-n") ||
+                 !strcmp(a.argv()[argpos],"--nocopyvideo"))
+        {
+            noCopyVideo = true;
+        }
     }
 
     if ((! found_infile && !(found_chanid && found_starttime)) ||
@@ -276,7 +285,8 @@
                                    (char *)tmpfile.ascii(),
                                    profilename, useCutlist, 
                                    (fifosync || keyframesonly), use_db,
-                                   fifodir);
+                                   fifodir,
+                                   noCopyVideo);
     int retval;
     if (result == REENCODE_MPEG2TRANS)
     {
Index: mythtv/programs/mythtranscode/transcode.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythtranscode/transcode.cpp,v
retrieving revision 1.6
diff -u -r1.6 transcode.cpp
--- mythtv/programs/mythtranscode/transcode.cpp	19 Feb 2004 08:26:05 -0000	1.6
+++ mythtv/programs/mythtranscode/transcode.cpp	17 Jul 2004 18:10:35 -0000
@@ -231,7 +231,8 @@
 int Transcode::TranscodeFile(char *inputname, char *outputname,
                               QString profileName,
                               bool honorCutList, bool framecontrol,
-                              bool chkTranscodeDB, QString fifodir)
+                              bool chkTranscodeDB, QString fifodir,
+                              bool noCopyVideo)
 { 
     int audioframesize;
     int audioFrame = 0;
@@ -343,7 +344,7 @@
     }
 
     if (vidsetting == encodingType && !framecontrol &&
-        fifodir == NULL && honorCutList)
+        fifodir == NULL && honorCutList && !noCopyVideo)
     {
         copyvideo = true;
         VERBOSE(VB_GENERAL, "Reencoding video in 'raw' mode");
Index: mythtv/programs/mythtranscode/transcode.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythtranscode/transcode.h,v
retrieving revision 1.3
diff -u -r1.3 transcode.h
--- mythtv/programs/mythtranscode/transcode.h	19 Feb 2004 08:26:05 -0000	1.3
+++ mythtv/programs/mythtranscode/transcode.h	17 Jul 2004 18:10:36 -0000
@@ -22,7 +22,8 @@
      int TranscodeFile(char *inputname, char *outputname,
                               QString profileName,
                               bool honorCutList, bool framecontrol,
-                              bool chkTranscodeDB, QString fifodir);
+                              bool chkTranscodeDB, QString fifodir,
+                              bool noCopyVideo);
   private:
     bool GetProfile(QString profileName, QString encodingType);
     void ReencoderAddKFA(long curframe, long lastkey, long num_keyframes);


More information about the mythtv-dev mailing list