
Recherche avancée
Autres articles (99)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (8239)
-
Crontab task scheduled every hour stops running from 11am to 12am
11 août 2019, par technikI have a rather weird issue. My aim is to use ffmpeg to grab a screenshot from a home CCTV cameras rtsp stream every hour. I want to do this in order to make a timelapse. However everyday from 11am to 12am (the next day) there are no snapshots saved.
On an always on Debian machine, this is the shell script I have that crontab calls :
dt=$(date +"%d%m%2y%I%M%S")
ffmpeg -rtsp_transport tcp -i "rtsp://IP:554/..." -frames 1 /user/snapshots/ch1/$dt.jpgRunning it by itself works fine and saves a jpg snapshot successfully to the right folders.
In
crontab -e
I have the following line :
0 * * * * /bin/sh //user/snap.sh
Thanks.
-
FFmpeg : crossfading audio with multiple files, but works with video only
12 février 2024, par JayCravensI've found this script that cross-fade's all mp4's in the directory. If I try to add the audio with
AUDIO="[0:a]afade=d=1[a0];"
, using the same iteration, it doesn't work.

This works fine...


#!/bin/bash

CMD="ffmpeg"
FILES=(*.mp4)
SIZE=${#FILES[@]}
VIDEO=""
OUT=""

i="0"
total_duration="0"
for file in "${FILES[@]}"; do
 echo "$file"
 CMD="$CMD -i '$file'"

 duration=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of csv=p=0 "$file" | cut -d'.' -f1)

 if [[ "$i" == "0" ]]
 then
 VIDEO="[0:v]setpts=PTS-STARTPTS[v0];"
 else
 fade_start=$((total_duration))
 VIDEO="${VIDEO}[${i}:v]format=yuva420p,fade=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+(${fade_start}/TB)[v${i}];"
 if (( i < SIZE-1 ))
 then
 if (( i == 1 ))
 then
 OUT="${OUT}[v0][v1]overlay[outv1];"
 else
 OUT="${OUT}[outv$((i-1))][v${i}]overlay[outv${i}];"
 fi
 else
 if (( SIZE == 2 ))
 then
 OUT="${OUT}[v0][v1]overlay,format=yuv420p[outv]"
 else
 OUT="${OUT}[outv$((i-1))][v${i}]overlay,format=yuv420p[outv]"
 fi
 fi
 fi

 total_duration=$((total_duration+duration))

 i=$((i+1))
done

CMD="$CMD -filter_complex \"${VIDEO}${OUT}\" -c:v libx264 -preset ultrafast -map [outv] crossfade.mp4"

echo "$CMD"

bash -c "$CMD"



I read
acrossfade
requires 32bit little endian, so I went toafade
.
It didn't change anything.

I've got this working via fade in/out, for any number of files, with working audio. I still have to preprocess the audio sections which require fading.


#!/bin/bash

if [ -e *.mkv ]; then
 file_type=".mkv"
else
 file_type=".mp4"
fi

mkdir ./temp
for file in *$file_type; do mv "$file" "in_$file"; done

# Function to fade in video
function fade_in() {
file_list1=(in_*)
 echo "Executing fade_in"
 for file in "${file_list1[@]}"; do
 ffmpeg -i "$file" -y -vf fade=in:0:30 -hide_banner -preset ultrafast "out_$file"
 done
mv in_* ./temp
}
export -f fade_in

# Function to fade out video
function fade_out() {
 file_list2=(out_*)
 echo "Executing fade_out"
 for file in "${file_list2[@]}"; do
 frame_count=$(ffmpeg -i $file -map 0:v:0 -c copy -f null -y /dev/null 2>&1 | grep -Eo 'frame= *[0-9]+ *' | grep -Eo '[0-9]+' | tail -1)
 frame_start=$((frame_count - 30))
 ffmpeg -i "$file" -y -vf fade=out:"$frame_start":30 -hide_banner -preset ultrafast "to_mux_$file"
 done
 mv out_* ./temp
}

export -f fade_out

bash -c "fade_in"
bash -c "fade_out"

ls --quoting-style=shell-always -1v *$file_type > tmp.txt
sed 's/^/file /' tmp.txt > list.txt && rm tmp.txt

ffmpeg -f concat -safe 0 -i list.txt -c copy -shortest -movflags +faststart fade_muxed$file_type

mv to_mux_* ./temp
rm list.txt
#rm -rf ./temp

exit 0



Number the file name's sequentially (i.e. 01_file.mkv 02_file.mkv etc.), to ensure order, or it will be up to the directory sort. Using
ls --quoting-style=shell-always -v1
has proved very reliable. It should handle 99% of naming conventions.It's not a cross fade, but the two second transition is very close. With working and synchronized audio.
If you have a good multi-file concatenation method that includes audio cross-fading, I'm still looking.


Ed Morton, I completely agree, sir. One-hundred percent. I didn't write the first script. I would NEVER use capitals. They're horrible. I
"like_full_words"
with_
's. Never for any reason other than visual though, so that was a great read, I recommend it.

-
ffmpeg incorrectly adds a fixed delay to the end of each video chunk
13 janvier 2023, par SkylerI am trying to combine audio a video data to output as an mp4 file using the command below, the videos are segmented to match the exact length of the audio file they are going to be merged with :


command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {} -loglevel {} -c:v h264_nvenc'.format(
 audio_file, temp_result_avi, outfile, self.ffmpeg_loglevel
 )
 subprocess.call(command, shell=True)



however each video made by this is exactly 24 ms longer so this causes large delays as they get stitched back together. This doesnt work since the combined video needs to be combined back with another video and the desync gets worse as you get further in the combined videos.


How can I remedy this ?