Changeset 43792 in spip-zone
- Timestamp:
- Jan 22, 2011, 7:06:19 PM (10 years ago)
- Location:
- _plugins_/spipmotion
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/spipmotion/inc/ffmpeg_infos.php
r37011 r43792 24 24 sous_repertoire(_DIR_CACHE,'spipmotion'); 25 25 } 26 $chemin = lire_config('spipmotion/chemin',' ');26 $chemin = lire_config('spipmotion/chemin','ffmpeg'); 27 27 $chemin_fichier = _DIR_CACHE.'spipmotion/ffmpeg_codecs'; 28 $chemin_out = _DIR_CACHE.'spipmotion/out'; 28 29 29 30 if(!$chemin){ … … 31 32 } 32 33 34 if($GLOBALS['meta']['spipmotion_safe_mode'] == 'oui'){ 35 $spipmotion_sh = $GLOBALS['meta']['spipmotion_safe_mode_exec_dir'].'/spipmotion.sh'; 36 }else{ 37 $spipmotion_sh = find_in_path('script_bash/spipmotion.sh'); 38 } 33 39 /** 34 40 * On crée un fichier contenant l'ensemble de la conf de ffmpeg 35 41 */ 36 exec($chemin.' -formats &> '.$chemin_fichier,$retour,$bool); 37 exec('echo "==CODECS==" >> '.$chemin_fichier,$retour,$bool); 38 exec($chemin.' -codecs >> '.$chemin_fichier,$retour,$bool); 39 exec('echo "==BSFS==" >> '.$chemin_fichier,$retour,$bool); 40 exec($chemin.' -bsfs >> '.$chemin_fichier,$retour,$bool); 41 exec('echo "==PROTOCOLS==" >> '.$chemin_fichier,$retour,$bool); 42 exec($chemin.' -protocols >> '.$chemin_fichier,$retour,$bool); 43 exec('echo "==FILTERS==" >> '.$chemin_fichier,$retour,$bool); 44 exec($chemin.' -filters >> '.$chemin_fichier,$retour,$bool); 45 exec('echo "==PIX_FMTS==" >> '.$chemin_fichier,$retour,$bool); 46 exec($chemin.' -pix_fmts >> '.$chemin_fichier,$retour,$bool); 47 exec('echo "==fin==" >> '.$chemin_fichier,$retour,$bool); 42 supprimer_fichier($chemin_fichier); 43 44 spimotion_write($chemin_fichier,"==VERSION=="); 45 exec($spipmotion_sh.' --info "-version" --log '.$chemin_fichier,$retour,$bool); 46 spimotion_write($chemin_fichier,"==FORMATS=="); 47 exec($spipmotion_sh.' --info "-formats" --log '.$chemin_fichier,$retour,$bool); 48 spimotion_write($chemin_fichier,"==CODECS=="); 49 exec($spipmotion_sh.' --info "-codecs" --log '.$chemin_fichier,$retour,$bool); 50 spimotion_write($chemin_fichier,"==BSFS=="); 51 exec($spipmotion_sh.' --info "-bsfs" --log '.$chemin_fichier,$retour,$bool); 52 spimotion_write($chemin_fichier,"==PROTOCOLS=="); 53 exec($spipmotion_sh.' --info "-protocols" --log '.$chemin_fichier,$retour,$bool); 54 spimotion_write($chemin_fichier,"==FILTERS=="); 55 exec($spipmotion_sh.' --info "-filters" --log '.$chemin_fichier,$retour,$bool); 56 spimotion_write($chemin_fichier,"==PIX_FMTS=="); 57 exec($spipmotion_sh.' --info "-pix_fmts" --log '.$chemin_fichier,$retour,$bool); 58 spimotion_write($chemin_fichier,"==fin=="); 48 59 49 60 if (lire_fichier($chemin_fichier, $contenu)){ … … 194 205 * Si oui on ajoute sa version dans les metas aussi 195 206 */ 196 $ffmpeg2theora = exec('ffmpeg2theora',$retour ,$int);197 if(!empty($retour )){198 $info = $retour [0];207 $ffmpeg2theora = exec('ffmpeg2theora',$retour_theora,$int); 208 if(!empty($retour_theora)){ 209 $info = $retour_theora[0]; 199 210 preg_match('/ffmpeg2theora ([0-9a-z].*) - ([A-Z].*)/s',$info,$infos); 200 211 $data['spipmotion_ffmpeg2theora']['ffmpeg2theora'] = true; 201 212 $data['spipmotion_ffmpeg2theora']['version'] = $infos[1]; 202 213 $data['spipmotion_ffmpeg2theora']['libtheora_version'] = $infos[2]; 203 spip_log($data['spipmotion_ffmpeg2theora'],'test');204 214 ecrire_meta('spipmotion_ffmpeg2theora',serialize($data['spipmotion_ffmpeg2theora'])); 205 215 } … … 216 226 return $data; 217 227 } 228 229 function spimotion_write($chemin_fichier,$what){ 230 $f = @fopen($chemin_fichier, "ab"); 231 if ($f) { 232 fputs($f, "$what\n"); 233 fclose($f); 234 } 235 } 218 236 ?> -
_plugins_/spipmotion/script_bash/spipmotion.sh
r41253 r43792 98 98 --fpre) fpre="-fpre ${2}" 99 99 shift;; 100 --info) info="${2}" 101 shift;; 102 --log) log="${2}" 103 shift;; 100 104 esac 101 105 shift 102 106 done 103 107 104 ########## TRAITEMENT DES ARGUMENTS ############### 105 106 case "$entree" in 107 "") echo "$pasfichierentree"; exit 1;; 108 case "$chemin" in 109 "") chemin=$(which ffmpeg) 108 110 esac 109 111 110 case "$sortie" in 111 "") "$sortie" = "$entree.flv" 112 esac 113 114 case "$chemin" in 115 "") chemin="/usr/local/bin/ffmpeg" 116 esac 117 118 ########### Arguments spécifiques aux videos 119 120 case "$size" in 121 "") size="-s 320x240" 122 esac 123 124 case "$bitrate" in 125 "") bitrate="-vb 448k" 126 esac 127 128 case "$fps" in 129 "") fps="-r 15" 130 esac 131 132 case "$vcodec" in 133 "libx264") 134 case "$params_sup" in 135 "") params_sup="-vpre default" ;; 136 esac 137 shift;; 138 "") 112 function spipmotion_encodage (){ 113 114 ########## TRAITEMENT DES ARGUMENTS ############### 115 116 case "$entree" in 117 "") echo "$pasfichierentree"; exit 1;; 118 esac 119 139 120 case "$sortie" in 140 *".flv") vcodec="-vcodec flv" ;; 141 *".ogg"|*".ogv") vcodec="-vcodec libtheora" ;; 142 esac 143 shift;; 144 esac 145 ########### SI LA SORTIE EXISTE DÉJÀ ############# 146 147 148 if [ -e "$sortie" ] && [ ${FORCE} != "true" ] 149 then 150 PS3='> ' 151 echo "###############################################################" 152 echo "$textedejala"; 153 LISTE=("[y] $oui" "[n] $non") # liste de choix disponibles 154 select CHOIX in "${LISTE[@]}" ; do 155 case $REPLY in 156 1|y) 157 rm $sortie 158 break 159 ;; 160 2|n) 161 mv $sortie $sortie-backup 162 break 163 ;; 164 esac 165 done 121 "") "$sortie" = "$entree.flv" 122 esac 123 124 ########### Arguments spécifiques aux videos 125 126 case "$size" in 127 "") size="-s 320x240" 128 esac 129 130 case "$bitrate" in 131 "") bitrate="-vb 448k" 132 esac 133 134 case "$fps" in 135 "") fps="-r 15" 136 esac 137 138 case "$vcodec" in 139 "libx264") 140 case "$params_sup" in 141 "") params_sup="-vpre default" ;; 142 esac 143 shift;; 144 "") 145 case "$sortie" in 146 *".flv") vcodec="-vcodec flv" ;; 147 *".ogg"|*".ogv") vcodec="-vcodec libtheora" ;; 148 esac 149 shift;; 150 esac 151 152 ########### SI LA SORTIE EXISTE DÉJÀ ############# 153 if [ -e "$sortie" ] && [ ${FORCE} != "true" ] 154 then 155 PS3='> ' 156 echo "###############################################################" 157 echo "$textedejala"; 158 LISTE=("[y] $oui" "[n] $non") # liste de choix disponibles 159 select CHOIX in "${LISTE[@]}" ; do 160 case $REPLY in 161 1|y) 162 rm $sortie 163 break 164 ;; 165 2|n) 166 mv $sortie $sortie-backup 167 break 168 ;; 169 esac 170 done 171 fi 172 173 ############# ON UTILISE FFMPEG ################ 174 175 case "$sortie" in 176 *".mp3"|*".flac"|*".ogg"|*".oga" ) 177 echo "SPIPmotion v$VERSION 178 179 On encode un son 180 " 181 echo "nice -19 $chemin -i $entree $acodec $audiobitrate_quality $audiofreq $ac -y $sortie" 182 nice -19 "$chemin" -i $entree $acodec $audiobitrate_quality $audiofreq $ac -y $sortie ;; 183 *".flv"|*".mp4"|*".ogv"|*".mov"|*".m4v"|*".webm" ) 184 echo "SPIPmotion v$VERSION 185 186 On encode une video 187 " 188 echo "nice -19 $chemin -i $entree $acodec $audiobitrate_quality $ac $audiofreq $pass $fps $size $vcodec $bitrate $params_sup $fpre -y $sortie" 189 nice -19 $chemin -i $entree $acodec $audiobitrate_quality $ac $audiofreq $pass $fps $size $vcodec $bitrate $params_sup $fpre -y $sortie ;; 190 esac 191 } 192 193 function ffmpeg_infos () 194 { 195 [ -z "$info" ] && return 1 196 if [ -z "$log" ];then 197 log="/dev/null" 198 fi 199 ffmpeg $1 2> /dev/null >> $log 200 } 201 202 if [ ! -z "$info" ];then 203 ffmpeg_infos 204 else 205 spipmotion_encodage 166 206 fi 167 207 168 ############# ON UTILISE FFMPEG ################169 170 case "$sortie" in171 *".mp3"|*".flac"|*".ogg"|*".oga" )172 echo "SPIPmotion v$VERSION173 174 On encode un son175 "176 echo "nice -19 $chemin -i $entree $acodec $audiobitrate_quality $audiofreq $ac -y $sortie"177 nice -19 "$chemin" -i $entree $acodec $audiobitrate_quality $audiofreq $ac -y $sortie ;;178 *".flv"|*".mp4"|*".ogv"|*".mov"|*".m4v"|*".webm" )179 echo "SPIPmotion v$VERSION180 181 On encode une video182 "183 echo "nice -19 $chemin -i $entree $acodec $audiobitrate_quality $ac $audiofreq $pass $fps $size $vcodec $bitrate $params_sup $fpre -y $sortie"184 nice -19 $chemin -i $entree $acodec $audiobitrate_quality $ac $audiofreq $pass $fps $size $vcodec $bitrate $params_sup $fpre -y $sortie ;;185 esac186 187 208 exit $?
Note: See TracChangeset
for help on using the changeset viewer.