Fix #47 : MediaTypeInterface::save adds filters depending on the codec
This commit is contained in:
		
					parent
					
						
							
								5cbec1981b
							
						
					
				
			
			
				commit
				
					
						ef237a8f76
					
				
			
		
					 4 changed files with 162 additions and 13 deletions
				
			
		|  | @ -59,19 +59,20 @@ class Video extends Audio | |||
|     { | ||||
|         $commands = array('-y', '-i', $this->pathfile); | ||||
| 
 | ||||
|         $this->addFilter(new SimpleFilter($format->getExtraParams(), 10)); | ||||
|         $filters = clone $this->filters; | ||||
|         $filters->add(new SimpleFilter($format->getExtraParams(), 10)); | ||||
| 
 | ||||
|         if ($this->driver->getConfiguration()->has('ffmpeg.threads')) { | ||||
|             $this->addFilter(new SimpleFilter(array('-threads', $this->driver->getConfiguration()->get('ffmpeg.threads')))); | ||||
|             $filters->add(new SimpleFilter(array('-threads', $this->driver->getConfiguration()->get('ffmpeg.threads')))); | ||||
|         } | ||||
|         if (null !== $format->getVideoCodec()) { | ||||
|             $this->addFilter(new SimpleFilter(array('-vcodec', $format->getVideoCodec()))); | ||||
|             $filters->add(new SimpleFilter(array('-vcodec', $format->getVideoCodec()))); | ||||
|         } | ||||
|         if (null !== $format->getAudioCodec()) { | ||||
|             $this->addFilter(new SimpleFilter(array('-acodec', $format->getAudioCodec()))); | ||||
|             $filters->add(new SimpleFilter(array('-acodec', $format->getAudioCodec()))); | ||||
|         } | ||||
| 
 | ||||
|         foreach ($this->filters as $filter) { | ||||
|         foreach ($filters as $filter) { | ||||
|             $commands = array_merge($commands, $filter->apply($this, $format)); | ||||
|         } | ||||
| 
 | ||||
|  | @ -97,8 +98,11 @@ class Video extends Audio | |||
|         $commands[] = '4'; | ||||
|         $commands[] = '-trellis'; | ||||
|         $commands[] = '1'; | ||||
|         $commands[] = '-b:a'; | ||||
|         $commands[] = $format->getAudioKiloBitrate() . 'k'; | ||||
| 
 | ||||
|         if (null !== $format->getAudioKiloBitrate()) { | ||||
|             $commands[] = '-b:a'; | ||||
|             $commands[] = $format->getAudioKiloBitrate() . 'k'; | ||||
|         } | ||||
| 
 | ||||
|         $passPrefix = uniqid('pass-'); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue