
Recherche avancée
Autres articles (77)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (6714)
-
avcodec/qsvenc : Remove dead code for user-provided buffers
9 septembre 2021, par Andreas Rheinhardt -
Rails Paperclip : Skip ffmpeg in video uploading
4 octobre 2017, par aliahme922I have a rails API application and I am using paperclip (s3 storage) for video upload. The file is sent from Android app which is already converted into mp4 and resized at its end but when I add the processor ffmpeg to my video attachment the ffmpeg tries to transcode and resize the video again, which I reckon is not necessary.
I am not sure that my point is valid that is it always necessary for paperclip to run ffmpeg command of already converted video sent
from client side ? Or we can stop it of doing it so or perhaps it might not even need to be required. Because what I read from different ffmpeg sources is that it converts a video to different formats so that the file becomes heterogeneous and can be played in various players and devices. Anyway the purpose of this question is to ask that I have a small EC2 instance in which ffmpeg is run in background through sidekiq because it takes a lot of time for conversion and since, what I saw, due to its high memory consumption of CPU and Memory my server went down for like half an hour. So instead of upgrading the instance I need to know that in my case do I have to use ffmpeg or not ?Well for the time being, to get rid out of this I changed the concurrency of sidekiq to run only 1 thread at a time and also I made some output changes to ffmpeg processor in my attachment config in order to reduce conversion time.
has_attached_file :url,
styles: {
original: {
format: 'mp4', streaming: true,
convert_options: {
output: {
'c:v': 'libx264',
preset: 'ultrafast',
movflags: '+faststart',
crf: '23',
'c:a': 'aac',
'b:a': '128k',
'vf': 'scale=-2:720,format=yuv420p'
}
}
}
},
processors: [
:ffmpeg
],
only_process: [
:original
]This helped me and solved my problem, but again I think for my case I can take much better approach. Need your feedback guys, I will really appreciate.
-
Convert a bash script to Windows bat script [closed]
17 mai 2024, par gyandooI have a bash script, now I need to convert it to bat.


What the script does is based on the shortcut the script checks the audio codec and video codec using ffprobe and then loops through all the files in the folder to convert the file(s) using the presets based on which one the shortcut calls.


It also limits the processor usage before running ffmpeg.


Here's the script :


#!/bin/sh
FILES="/home/red/Downloads/to_convert/*"
to_convert="/home/red/Downloads/to_convert"
TYPE="$1"
#echo "$TYPE"
if [ -e '/tmp/convert.txt' ]; then
 echo "Ffmpeg is currently converting a file!"
 exit 0
else
if [ "$(ls -A $to_convert)" ];
then
 #Create a temp file so if the script is run hourly and there is an existing instance running the scripts exits
 echo >> '/tmp/convert.txt'
 #iterate through each file in the directory
 for f in $FILES
 do
 FILENAME1=$(basename "$f")
 FILENAME=${FILENAME1%.*}

 
 ## Detect what audio codec is being used:
 audio=$(ffprobe "$f" 2>&1 | sed -n '/Audio:/s/.*: \([a-zA-Z0-9]*\).*/\1/p' | sed 1q)
 ## Detect video codec:
 video=$(ffprobe "$f" 2>&1 | sed -n '/Video:/s/.*: \([a-zA-Z0-9]*\).*/\1/p' | sed 1q)
 ## Set default audio settings (you may need to use a different encoder,
 ## since libfdk_aac is not re-distributable)
 aopts="-c:a libfdk_aac -vbr 3"
 ## Set default video settings:
 vopts="-c:v libx264 -crf 22 -preset veryfast"

 case "$audio" in
 aac|mp3 )
 #If the audio is one of the MP4-supported codecs,
 #copy the stream instead of transcoding
 aopts="-c:a copy"
 ;;
 "" )
 #If there is no audio stream, don't bother with audio
 aopts="-an"
 ;;
 * )
 ;;
 esac

 case "$video" in
 #If the video stream is one of the MP4-compatible formats,
 #copy the stream
 h264|mpeg4|mpeg2video|mpeg1video )
 vopts="-c:v copy"
 ;;
 "" )
 #If no video stream is detected, don't bother with video
 vopts="-vn"
 ;;
 * )
 ;;
 esac

 
 if [ "$TYPE" = "shrink" ]; then
 
 taskset -c 0,2 ffmpeg -i "$f" -vcodec libx265 -crf 28 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "phone" ]; then

 taskset -c 0,2 ffmpeg -y -i "$f" -vf scale=640:-2 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "pmv" ]; then

 taskset -c 0,2 ffmpeg -y -i "$f" -vf scale=360:-2 -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1 

 elif [ "$TYPE" = "music" ]; then

 taskset -c 0,2 ffmpeg -i "$f" -acodec libmp3lame "/home/red/Downloads/done/""$FILENAME"".mp3" && success=0 || success=1 

 elif [ "$TYPE" = "audio-boost" ]; then

 taskset -c 0,2 ffmpeg -i "$f" -vcodec copy -af "volume=10dB" "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "burn-first-sub" ]; then 

 taskset -c 0,2 ffmpeg -i "$f" -vf "subtitles=""$f"":si=0'" "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "burn-srt" ]; then 

 taskset -c 0,2 ffmpeg -i "$f" -vf "subtitles=/home/red/Downloads/to_convert/""$FILENAME"".srt" "/home/huckleberry/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "audio-track2" ]; then 

 taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v -map 0:a:1 $vopts $aopts -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 elif [ "$TYPE" = "split" ]; then 

 taskset -c 0,2 MP4Box -splits 1996800 "$f" && success=0 || success=1

 elif [ "$TYPE" = "fix" ]; then 
 taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v:0 -map 0:a:0 -vcodec libx264 -acodec aac -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 else 

 taskset -c 0,2 ffmpeg -y -i "$f" -map 0:v -map 0:a:0 $vopts $aopts -map_metadata -1 "/home/red/Downloads/done/""$FILENAME"".mp4" && success=0 || success=1

 TYPE="converted"

 fi

 
 if [ $success -eq 0 ]; then
 swaks --header Subject:"${TYPE} - ${FILENAME}" --body "${FILENAME}" -S
 echo "Removing $f file..."
 rm "$f"
 else
 swaks --header Subject:"failed - ${FILENAME}" --body "${FILENAME}" -S
 echo "process failed"
 fi 
 
 done
 
 #remove the temp file created
 rm "/tmp/convert.txt"
 exit 0
else
 echo "to_convert folder is empty"
 exit 0
fi
exit 0
fi