summaryrefslogtreecommitdiff
blob: 6f5b05b228a0ddf4b330683c96cf66da36c013ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
diff -Naur ttcut-old/avstream/ttcommon.cpp ttcut/avstream/ttcommon.cpp
--- ttcut-old/avstream/ttcommon.cpp	2011-05-05 00:00:33.936254667 +0200
+++ ttcut/avstream/ttcommon.cpp	2011-05-05 00:03:27.396254667 +0200
@@ -51,6 +51,18 @@
   return sNewFileName;
 }
 
+// return the aspect ratio as string value
+QString ttAspectRatioText(int aspect_ratio_information)
+{
+  QString szTemp;
+
+  if ( aspect_ratio_information == 1 ) szTemp = "1:1";
+  if ( aspect_ratio_information == 2 ) szTemp = "4:3";
+  if ( aspect_ratio_information == 3 ) szTemp = "16:9";
+  if ( aspect_ratio_information == 4 ) szTemp = "2.21:1";
+
+  return szTemp;
+}
 
 // check if file fName exists
 bool ttFileExists( QString fName )
diff -Naur ttcut-old/avstream/ttcommon.h ttcut/avstream/ttcommon.h
--- ttcut-old/avstream/ttcommon.h	2011-05-05 00:00:33.936254667 +0200
+++ ttcut/avstream/ttcommon.h	2011-05-05 00:03:58.412921334 +0200
@@ -11,6 +11,7 @@
 extern "C" bool    ttDeleteFile( QString fName );
 extern "C" QString ttAddFileExt( QString fName, const char* cExt );
 extern "C" QString ttChangeFileExt( QString fName, const char* cExt );
+extern "C" QString ttAspectRatioText(int aspect_ratio_information);
 extern "C" QTime   ttMsecToTime( int msec );
 extern "C" QTime   ttMsecToTimeD( double msec );
 extern "C" QTime   ttFramesToTime(long lFrames, float fps);
diff -Naur ttcut-old/avstream/ttmpeg2videoheader.cpp ttcut/avstream/ttmpeg2videoheader.cpp
--- ttcut-old/avstream/ttmpeg2videoheader.cpp	2011-05-05 00:00:33.936254667 +0200
+++ ttcut/avstream/ttmpeg2videoheader.cpp	2011-05-05 00:05:42.999588000 +0200
@@ -170,18 +170,11 @@
 }
 
 /* /////////////////////////////////////////////////////////////////////////////
- * Returns the aspect ration as string value
+ * Returns the aspect ratio as string value
  */
 QString TTSequenceHeader::aspectRatioText()
 {
-  QString szTemp;
-
-  if ( aspect_ratio_information == 1 ) szTemp = "1:1";
-  if ( aspect_ratio_information == 2 ) szTemp = "4:3";
-  if ( aspect_ratio_information == 3 ) szTemp = "16:9";
-  if ( aspect_ratio_information == 4 ) szTemp = "2.21:1";
-
-  return szTemp;
+  return ttAspectRatioText(aspect_ratio_information);
 }
 
 /* /////////////////////////////////////////////////////////////////////////////
diff -Naur ttcut-old/avstream/ttmpeg2videostream.cpp ttcut/avstream/ttmpeg2videostream.cpp
--- ttcut-old/avstream/ttmpeg2videostream.cpp	2011-05-05 00:00:33.936254667 +0200
+++ ttcut/avstream/ttmpeg2videostream.cpp	2011-05-05 00:00:43.579588002 +0200
@@ -1505,7 +1505,7 @@
 
   QDir    temp_dir( TTCut::tempDirPath );
   QString avi_out_file   = "encode.avi";
-  QString mpeg2_out_file = "encode";          // extension is added by transcode (!)
+  QString mpeg2_out_file = "encode.m2v";
   new_file_info.setFile( temp_dir, avi_out_file );
   
   TTPicturesHeader* start_pic = header_list->pictureHeaderAt( start );
@@ -1538,7 +1538,7 @@
   TTTranscodeProvider* transcode_prov = new TTTranscodeProvider( );
   transcode_prov->setParameter( enc_par );
 
-  // encode the part with transcode
+  // encode the part with ffmpeg
   if ( transcode_prov->encodePart() )
   {
     new_file_info.setFile( temp_dir, "encode.m2v" );
@@ -1565,7 +1565,7 @@
   }
   else
   {
-    log->errorMsg(c_name, "Error in transcode part (!)");
+    log->errorMsg(c_name, "Error in ffmpeg part (!)");
   }
 
   // remove temporary files
diff -Naur ttcut-old/extern/tttranscode.cpp ttcut/extern/tttranscode.cpp
--- ttcut-old/extern/tttranscode.cpp	2011-05-05 00:00:33.939588000 +0200
+++ ttcut/extern/tttranscode.cpp	2011-05-05 00:02:27.062921334 +0200
@@ -49,9 +49,9 @@
   // message logger instance
   log = TTMessageLogger::getInstance();
   
-  QString str_head = "starting encoder >>>transcode -y ffmpeg<<<";
+  QString str_head = "starting encoder >>>ffmpeg<<<";
 
-  str_command       = "transcode";
+  str_command       = "ffmpeg";
   transcode_success = false;
 
   setModal( true );
@@ -76,7 +76,7 @@
 {
 #if defined (TTTRANSCODE_DEBUG)
   log->debugMsg( c_name, "----------------------------------------------------" );
-  log->debugMsg( c_name, "transcode parameter:" );
+  log->debugMsg( c_name, "ffmpeg parameter:" );
   log->debugMsg( c_name, "----------------------------------------------------" );
   log->debugMsg( c_name, "avi-file    : %s",    qPrintable(enc_par.avi_input_finfo.absoluteFilePath()) );
   log->debugMsg( c_name, "mpeg-file   : %s",    qPrintable(enc_par.mpeg2_output_finfo.absoluteFilePath()) );
@@ -86,32 +86,32 @@
   log->debugMsg( c_name, "----------------------------------------------------" );
 #endif
 
-  //transcode -i encode.avi --pre_clip 0 -y ffmpeg --export_prof dvd-pal --export_asr 2 -o encode
   QString str_aspect;
-  str_aspect.sprintf("%d",enc_par.video_aspect_code );
+  str_aspect = ttAspectRatioText(enc_par.video_aspect_code);
 
   QString str_format;
   str_format.sprintf("%dx%d", enc_par.video_width, enc_par.video_height);
 
   QString str_bitrate;
-  str_bitrate.sprintf("%f", enc_par.video_bitrate);
+  str_bitrate.sprintf("%.0f", enc_par.video_bitrate);
+
+  QString str_aspect_opt;
+  str_aspect_opt = "setdar=";
+
+  str_aspect_opt += str_aspect;
 
   strl_command_line.clear();
 
   strl_command_line << "-i"
-		    << enc_par.avi_input_finfo.absoluteFilePath()
-		    << "--pre_clip"
-		    << "0"
-		    //<< "-y"               // isn't neccessary unless --export_prof is specified!
-		    //<< "mpeg2enc,mp2enc"  // mpeg2enc->video, mp2enc->audio!
-        //<< "-F"
-        //<< "8,\"-v 1 -q 3\""
-		    << "--export_prof"
-		    << "dvd"            // dvd-pal
-		    << "--export_asr"
-		    << str_aspect
-		    << "-o"
-		    << enc_par.mpeg2_output_finfo.absoluteFilePath();
+            << enc_par.avi_input_finfo.absoluteFilePath()
+            << "-y"
+            << "-target"
+            << "dvd" //autodetects pal/ntsc
+            << "-f"
+            << "mpeg2video" //else ffmpeg creates an mpegps stream that mplex can not handle
+            << "-vf"
+            << str_aspect_opt //workaround for mpeg2video not preserving aspect ratio in combination with --enable-avfilter
+            << enc_par.mpeg2_output_finfo.absoluteFilePath();
 
   log->infoMsg(c_name, strl_command_line.join(" "));
 }
@@ -124,7 +124,7 @@
   int update        = EVENT_LOOP_INTERVALL;     //update intervall for local event loop
   transcode_success = false;      
   
-  // create the process object for transcode
+  // create the process object for ffmpeg
   proc = new QProcess();
   
   // read both channels: stderr and stdout
@@ -197,12 +197,12 @@
   switch (e_status) {
     case QProcess::NormalExit:
       //log->debugMsg(c_name, "The process ecxited normally: %d", e_code);
-      procMsg = tr("Transcode exit normally ... done(0)");
+      procMsg = tr("ffmpeg exit normally ... done(0)");
       transcode_success = true;
       break;
     case QProcess::CrashExit:
       //log->debugMsg(c_name, "The process crashed: %d", e_code);
-      procMsg = tr("Transcode crashed");
+      procMsg = tr("ffmpeg crashed");
       transcode_success = false;
       break;
     default: