Index: programs/mythtranscode/main.cpp
===================================================================
--- programs/mythtranscode/main.cpp	(revision 17451)
+++ programs/mythtranscode/main.cpp	(working copy)
@@ -69,7 +69,7 @@
 
 int main(int argc, char *argv[])
 {
-    QString chanid, starttime, infile, outfile;
+    QString chanid, starttime, infile, outfile, out_map_file;
     QString profilename = QString("autodetect");
     QString fifodir = NULL;
     int jobID = -1;
@@ -92,6 +92,7 @@
     int found_chanid = 0;
     int found_infile = 0;
     int update_index = 1;
+    int create_mapfile = 0;
     int isVideo = 0;
 
     for (int argpos = 1; argpos < a.argc(); ++argpos)
@@ -169,6 +170,7 @@
                 (a.argv()[argpos+1][0] != '-' || a.argv()[argpos+1][1] == 0x0))
             {
                 outfile = a.argv()[argpos + 1];
+                out_map_file = outfile + QString(".map");
                 update_index = 0;
                 ++argpos;
             }
@@ -539,8 +541,15 @@
         return TRANSCODE_EXIT_REMOTE_FILE;
     }
 
-    if (outfile.isNull())
-        outfile = infile + ".tmp";
+    // Only allow creation of file "title.tmp" if options permit
+    VERBOSE(VB_IMPORTANT, QString("Test 2."));
+    if (outfile.isNull() && !(isVideo && build_index && mpeg2 ) )
+            outfile = infile + ".tmp";
+    // Cancel the ".tmp" file if it will be empty
+    // VERBOSE(VB_IMPORTANT, QString("Using out_map_file is '%1'")
+    //           .arg(out_map_file));
+    if (!outfile.isNull() && isVideo && build_index && mpeg2 )
+        outfile[0] = NULL;
 
     if (jobID >= 0)
         JobQueue::ChangeJobStatus(jobID, JOB_RUNNING);
@@ -577,10 +586,12 @@
            update_func = &UpdateJobQueue;
            check_func = &CheckJobQueue;
         }
+
         MPEG2fixup *m2f = new MPEG2fixup(infile.ascii(), outfile.ascii(),
                                          &deleteMap, NULL, false, false, 20,
                                          showprogress, otype, update_func,
                                          check_func);
+
         if (build_index)
         {
             int err = BuildKeyframeIndex(m2f, infile, posMap, jobID);
@@ -589,7 +600,7 @@
             if (update_index)
                 UpdatePositionMap(posMap, NULL, pginfo);
             else
-                UpdatePositionMap(posMap, outfile + QString(".map"), pginfo);
+                UpdatePositionMap(posMap, out_map_file , pginfo);
         }
         else
         {
@@ -602,8 +613,7 @@
                     if (update_index)
                         UpdatePositionMap(posMap, NULL, pginfo);
                     else
-                        UpdatePositionMap(posMap, outfile + QString(".map"),
-                                          pginfo);
+                        UpdatePositionMap(posMap, out_map_file , pginfo);
                 }
             }
         }
