@@ -30,8 +30,7 @@ package export_SVCD;
3030					};
3131		bless ($self , $class );
3232	#  Make sure that we have an mp2 encoder
33- 		$Prog {mp2_encoder } = find_program(' toolame' ' mp2enc' 
34- 		push  @{$self -> {errors }}, ' You need toolame or mp2enc to export an svcd.' unless  ($Prog {mp2_encoder });
33+ 		$Prog {mp2_encoder } = find_program(' toolame' 
3534	#  Make sure that we have an mplexer
3635		$Prog {mplexer } = find_program(' tcmplex' ' mplex' 
3736		push  @{$self -> {errors }}, ' You need tcmplex or mplex to export an svcd.' unless  ($Prog {mplexer });
@@ -180,12 +179,18 @@ package export_SVCD;
180179		}
181180	#  Now we fork off a process to encode the audio
182181		if  ($Prog {mp2_encoder } =~ / \b toolame$ / 
183- 			$sample  = $nuv_info {audio_sample_rate } / 1000;
184- 			$command  = " nice -n 19 toolame -s $sample  -m j -b $self ->{a_bitrate} $self ->{fifodir}/audout $self ->{tmp_a}" 
182+ 		#  Resample audio?
183+ 			if  ($nuv_info {audio_sample_rate } != 44100) {
184+ 				$command  = " nice -n 19 sox -t raw -r $nuv_info {audio_sample_rate} -s -w -c 2 $self ->{fifodir}/audout -t raw -r 44100 -s -w -c 2 - resample" 
185+ 						  ."  | nice -n 19 toolame -s 44.1 -m j -b $self ->{a_bitrate} - $self ->{tmp_a}" 
186+ 			}
187+ 		#  Audio is the proper sample rate
188+ 			else  {
189+ 				$command  = " nice -n 19 toolame -s 44.1 -m j -b $self ->{a_bitrate} $self ->{fifodir}/audout $self ->{tmp_a}" 
190+ 			}
185191		}
186192		else  {
187- 			$command  = " nice -n 19 ffmpeg -f s16le -ar $nuv_info {audio_sample_rate} -ac 2 -i $self ->{fifodir}/audout -vn -f wav -" 
188- 					  ."  | nice -n 19 mp2enc -b $self ->{a_bitrate} -r $nuv_info {audio_sample_rate} -s -o $self ->{tmp_a}" 
193+ 			$command  = " nice -n 19 ffmpeg -f s16le -ar $nuv_info {audio_sample_rate} -ac 2 -i $self ->{fifodir}/audout -ar 44100 -ab $self ->{a_bitrate} -vn -f mp2 $self ->{tmp_a}" 
189194		}
190195		if  ($DEBUG ) {
191196			print  " \n toolame command:\n\n $command \n " 
0 commit comments