Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 250 | Rev 252 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 250 Rev 251
Línea 116... Línea 116...
116
                            'width' =>  $sizes[0],
116
                            'width' =>  $sizes[0],
117
                            'height' => $sizes[1]
117
                            'height' => $sizes[1]
118
                        ]);    
118
                        ]);    
119
                    }
119
                    }
Línea 120... Línea -...
120
                    
-
 
121
                    
-
 
122
                    //$cmd        = "/usr/bin/ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width  $full_filename";
120
                    
123
                    $cmd        = "/usr/bin/ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width  $full_filename";
-
 
124
                    
-
 
125
                    echo $cmd . PHP_EOL. PHP_EOL. PHP_EOL;
-
 
126
                    
121
                    $cmd        = "/usr/bin/ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width  $full_filename";
127
                    $response   = trim(shell_exec($cmd));
-
 
128
                    echo $response . PHP_EOL. PHP_EOL. PHP_EOL;
-
 
129
                    
-
 
Línea 130... Línea 122...
130
                    
122
                    $response   = trim(shell_exec($cmd));
131
                    
123
                    
132
                    $lines = explode("\n", $response);
124
                    $lines = explode("\n", $response);
133
                    foreach($lines as $line)
125
                    foreach($lines as $line)
Línea 141... Línea 133...
141
                            $values = explode('=', $line);
133
                            $values = explode('=', $line);
142
                            $source_height = $values[1];
134
                            $source_height = $values[1];
143
                        }
135
                        }
144
                    }
136
                    }
Línea 145... Línea -...
145
                    
-
 
146
 
-
 
147
             
-
 
148
                    
-
 
Línea 149... Línea 137...
149
                    
137
                    
150
                    
-
 
151
                    if($source_width && $source_height) {
-
 
152
                        
138
                    
Línea 153... Línea 139...
153
                        
139
                    if($source_width && $source_height) {
154
                        $orientation = $source_width > $source_height ? 'L' : 'P';
140
                        $orientation = $source_width > $source_height ? 'L' : 'P';
Línea 162... Línea 148...
162
                            }
148
                            }
Línea 163... Línea 149...
163
 
149
 
164
                            if($orientation == 'L' && $target_width <  $size['width']) {
150
                            if($orientation == 'L' && $target_width <  $size['width']) {
165
                                $target_width   = $size['width'];
151
                                $target_width   = $size['width'];
166
                                $target_height  = $size['height'];
152
                                $target_height  = $size['height'];
167
                            }
-
 
168
                            
153
                            }  
169
                        }
-
 
170
                        
-
 
171
                        
-
 
172
                        
-
 
173
                    
154
                        }
174
                    } else {
155
                    } else {
175
                        $target_width = $candidate_sizes[0]['width'];
156
                        $target_width = $candidate_sizes[0]['width'];
176
                        $target_height = $candidate_sizes[0]['height'];
157
                        $target_height = $candidate_sizes[0]['height'];
Línea 177... Línea -...
177
                    }
-
 
178
                    
-
 
179
                    
-
 
180
                    echo 'source_width = ' . $source_width . PHP_EOL;
-
 
181
                    echo 'source_height = ' . $source_height . PHP_EOL . PHP_EOL;
-
 
182
                    
-
 
183
                    
-
 
184
                    echo 'target_width = ' . $target_width . PHP_EOL;
-
 
185
                    echo 'target_height = ' . $target_height . PHP_EOL . PHP_EOL;
-
 
186
             
-
 
187
                    
158
                    }
188
                    
159
                    
189
                    if($source_width && $source_height) {
160
                    if($source_width && $source_height) {
190
                        $width_ratio    = $target_width / $source_width;
161
                        $width_ratio    = $target_width / $source_width;
Línea 195... Línea 166...
195
                        $resized_height = round($source_height * $radio);
166
                        $resized_height = round($source_height * $radio);
196
                    } else {
167
                    } else {
197
                        $resized_width = $target_width;
168
                        $resized_width = $target_width;
198
                        $resized_height = $target_height;
169
                        $resized_height = $target_height;
199
                    }
170
                    }
200
                    
-
 
201
                    
171
 
202
                    echo 'resized_width = ' . $resized_width . PHP_EOL;
-
 
203
                    echo 'resized_height = ' . $resized_height . PHP_EOL . PHP_EOL;
-
 
204
                    
-
 
205
                   
-
 
206
                    
-
 
207
                    
-
 
Línea 208... Línea 172...
208
                    
172
                    
209
                    $values = explode('.', $full_filename);
173
                    $values = explode('.', $full_filename);
Línea 210... Línea 174...
210
                    $full_tempname = $values[0] .'-' . uniqid() . '.' . $values[1];
174
                    $full_tempname = $values[0] .'-' . uniqid() . '.' . $values[1];
211
                    
-
 
212
                    rename($full_filename, $full_tempname);
175
                    
Línea 213... Línea 176...
213
                    
176
                    rename($full_filename, $full_tempname);
214
                    $sizeVideo = $resized_width . ':' . $resized_height;
177
                    $sizeVideo = $resized_width . ':' . $resized_height;
215
                    
178
                    
216
                    $cmd = "/usr/bin/ffmpeg -y -i $full_tempname -vf scale=$sizeVideo -c:a copy -c:s copy n -c:v libx265 -preset slower -crf 18  $full_filename";
-
 
217
                    $retdata = null;
-
 
218
                    $retval = null;
-
 
219
                    exec($cmd, $retdata, $retval);
179
                    $cmd = "/usr/bin/ffmpeg -y -i $full_tempname -vf scale=$sizeVideo -c:a copy -c:s copy -c:v libx265 -preset slower -crf 18  $full_filename";
220
                    $output->writeln("Retorno el estado : $retval  y la salida :");
180
                    $output->writeln("command  : $cmd" );
221
                    $output->writeln($retdata);
181
                    exec($cmd);
222
                   
182
 
223
                    $cmd            = "/usr/bin/ffmpeg -y -i $full_tempname  -frames:v 1 -vf scale=$sizeVideo $full_filename $full_filename_poster";
-
 
224
                    $retdata = null;
-
 
225
                    $retval = null;
-
 
Línea 226... Línea 183...
226
                    exec($cmd, $retdata, $retval);
183
                    $cmd            = "/usr/bin/ffmpeg -y -i $full_tempname  -frames:v 1 -vf scale=$sizeVideo  $full_filename_poster";
227
                    $output->writeln("Retorno el estado : $retval  y la salida :");
-
 
228
                    $output->writeln($retdata);
-
 
229
                    
-
 
230
                    @unlink($full_tempname);
184
                    $output->writeln("command  : $cmd" );
231
                    
-
 
232
           
-
 
233
                    
185
                    exec($cmd);
234
                    $videos_procesados++;
186
                    
235
                    
187
                    @unlink($full_tempname);
236
           
188
                    $videos_procesados++;