
Recherche avancée
Autres articles (28)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
ANNEXE : Les extensions, plugins SPIP des canaux
11 février 2010, parUn plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
Les extensions que MediaSPIP nécessite pour fonctionner
Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...) -
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)
Sur d’autres sites (5642)
-
ffmpeg command exports flac with wrong 'length' metadata, works fine for mp3
21 juillet 2023, par MartinI have some audio recorded in Audacity 3.2.3 that I have exported as an mp3 and a flac. Then I have this file
split_by_silence.sh


Which has hardcoded input path values that take an input file, split it by detecting silence, and then finally run an ffmpeg command to split the files. If you save the below code into a file
split.sh
, you can call it with the command$ ./split_by_silence.sh "value1" "value2"


# ./split_by_silence.sh "full_lowq.flac" %03d_output.flac
#IN=$1
#OUT=$2

OUT="%03d_output.flac"
IN="/mnt/e/martinradio/rips/vinyl/WIP/Dogs On Fire (1983, Vinyl)/dog on fire.flac"
OUTPUT_LOCATION="/mnt/e/martinradio/rips/vinyl/WIP/Dogs On Fire (1983, Vinyl)/"

true ${SD_PARAMS:="-18dB"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
 echo "Usage: split_by_silence.sh full.mp3 output_template_%03d.mp3"
 echo "Depends on FFmpeg, Bash, Awk, Perl 5. Not tested on Mac or Windows."
 echo ""
 echo "Environment variables (with their current values):"
 echo " SD_PARAMS=$SD_PARAMS Parameters for FFmpeg's silencedetect filter: noise tolerance and minimal silence duration"
 echo " MIN_FRAGMENT_DURATION=$MIN_FRAGMENT_DURATION Minimal fragment duration"
 exit 1
fi
#
# get comma separated list of split points (use ffmpeg to determine points where audio is at SD_PARAMS [-18db] )
#

echo "_______________________"
echo "Determining split points..." >& 2
SPLITS=$(
 ffmpeg -v warning -i "$IN" -af silencedetect="$SD_PARAMS",ametadata=mode=print:file=-:key=lavfi.silence_start -vn -sn -f s16le -y /dev/null \
 | grep lavfi.silence_start= \
 | cut -f 2-2 -d= \
 | perl -ne '
 our $prev;
 INIT { $prev = 0.0; }
 chomp;
 if (($_ - $prev) >= $ENV{MIN_FRAGMENT_DURATION}) {
 print "$_,";
 $prev = $_;
 }
 ' \
 | sed 's!,$!!'
)
echo "SPLITS= $SPLITS"

#
# Add 5 seconds to each of the comma separated numbers
#
# Convert the comma-separated string into an array
arr=($(echo $SPLITS | tr ',' '\n'))
# Initialize a new array to store the results
new_arr=()
# Iterate through each element and add 5 seconds of padding
for i in "${arr[@]}"; do
 result=$(echo "$i + 5" | bc -l)
 new_arr+=("$result")
done
# Convert the array back into a comma-separated string
NEW_SPLITS=$(IFS=,; echo "${new_arr[*]}")
# Print the result
echo "NEW_SPLITS= $NEW_SPLITS"
SPLITS=$NEW_SPLITS

#
# Print how many tracks should be exported
#
res="${SPLITS//[^,]}"
CHARCOUNT="${#res}"
num=$((CHARCOUNT + 2))
echo "Exporting $num tracks"
echo "_______________________"

#
# Split audio into individual tracks
#
current_directory=$(pwd)

cd "$OUTPUT_LOCATION"

echo "Running ffmpeg command: "

ffmpeg -i "$IN" -c copy -map 0 -f segment -segment_times "$SPLITS" "$OUT"
#ffmpeg -i "full_lowq.flac" -c copy -map 0 -f segment -segment_times "302.825,552.017" "%03d_output.flac"


echo "Done."

cd $current_directory

echo "running flac command"
# check flac file intrgrity



If I call this code for my flac file :


OUT="%03d_output.flac"
IN="/mnt/e/martinradio/rips/vinyl/WIP/Dogs On Fire (1983, Vinyl)/dog on fire.flac"



The outputted files have an incorrect metadata for the length. They all report as having the same length, but if i import any of them into audacity, the file has a correct length.




but if i run this for my mp3 file, we can see the correct length metadata :


OUT="%03d_output.mp3"
IN="/mnt/e/martinradio/rips/vinyl/WIP/Dogs On Fire (1983, Vinyl)/dogs on fire.mp3"





So there is something with my ffmpeg command that causes it to export flac files with wrong 'length' metadata


ffmpeg -i "$IN" -c copy -map 0 -f segment -segment_times "$SPLITS" "$OUT"




I've tried with the flac example to change
-c copy
to-c:a flac
, but that just gives every output flac file a length of 00:00:00

is it a problem with my ffmpeg command ? Or my files ? https://file.io/tIFsa1l70076
it works for mp3 files just fine, why does it have this issue with flac ?


-
FFMPEG - Struggling to find correct input audio codec parameters on macOS
20 septembre 2024, par XaviI am trying to read my external stereo microphone with ffmpeg within my Qt Windows+macOs application, but I am struggling to obtain consistent correct input codec parameters on macOs. My findings and suspicions so far :


The code I'm using in macOs is the following, where everything returns a successful return code :


avdevice_register_all();
 
 //macOs only, the same code in windows looks for "dshow" 
 const AVInputFormat *inputFormat = av_find_input_format("avfoundation");
 
 AVFormatContext* inputFormatContext;
 avformat_open_input(&inputFormatContext, inputDevice, inputFormat, NULL);

 avformat_find_stream_info(inputFormatContext, NULL);
 
 //... allocate the codec context for the single input stream and
 // copy the parameters from the stream to the context




In my standalone minimal reproducer this always results on the codec ID of the single stream being AV_CODEC_ID_PCM_F32LE, in both macOS and Windows. When I integrate this code in my Qt application on Windows, I get the same result. However, on macOS, most of the times results in the codec id of the stream being AV_CODEC_ID_PCM_S16LE (via AV_CODEC_ID_FIRST_AUDIO) and sometimes AV_CODEC_ID_PCM_F32LE. Both sample formats are supported by my microphone.


AV_CODEC_ID_PCM_F32LE always results in a correct output. AV_CODEC_ID_PCM_S16LE results on buzzy noisy audio slowed down to 0.5x, and If in this case I decode with AV_CODEC_ID_PCM_F32LE instead of copying the codec parameters from the stream, the output sounds correct again.


I am trying to write generic code, so while enforcing the AV_CODEC_ID_PCM_F32LE codec works, I'd rather understand what is happening.


What am I missing ? Is Qt interacting in some way that I can't think of ? I am compiling and linking my own ffmpeg libraries (6.1.1) and not using Qt's ones.


-
Clip long video segment quickly
30 janvier 2020, par PRManLet’s say I have a video called Concert.mp4. I want to extract a performance from it quickly with minimal reencoding. I want to do the equivalent of this, but faster :
ffmpeg -i "Concert.mp4" -ss 00:11:45 -to 00:18:15 -preset veryfast -y artist.mp4
This takes 17 seconds, which is way too long for our needs.
Now, it turns out that 11:45 and 18:15 don’t fall on iframes, so if you try this you will get a 3 second delay at the beginning before the video shows :
ffmpeg -i "Concert.mp4" -ss 00:11:45 -to 00:18:15 -c copy -y artist.mp4
Running this command, we can see where we need to cut :
ffprobe -read_intervals "11:00%19:00" -v error -skip_frame nokey -show_entries frame=pkt_pts_time -select_streams v -of csv=p=0 "Concert.mp4" > frames.txt
So what we need to do is encode the first 3.708 seconds, copy the middle, and then encode the last 5.912 seconds.
I can get the 3 segments to all look perfect (by themselves) like this :
ffmpeg -ss 698.698 -i "Concert.mp4" -ss 6.302 -t 3.708 -c:v libx264 -c:a copy -c:s copy -y clipbegin.mp4
ffmpeg -ss 708.708 -to 1089.088 -i "Concert.mp4" -c copy -y clipmiddle.mp4
ffmpeg -ss 1089.088 -i "Concert.mp4" -t 5.912 -c:v libx264 -c:a copy -c:s copy -y clipend.mp4
ffmpeg -f concat -i segments.txt -c copy -y artist.mp4segments.txt of course contains the following :
file 'clipbegin.mkv'
file 'clipmiddle.mkv'
file 'clipend.mkv'I saw this solution presented here, but no amount of tweaking gets it to work for me :
https://superuser.com/a/1039134/73272
As far as I can tell, this method doesn’t work at all. It crashes VLC pretty hard no matter what I try.
The combined video keeps glitching after the 3 seconds, probably because the PTS times are different or something (using some options, I have seen warning messages to this effect). Is there anything I can add to the commands above to get this to work ? The only requirement is that the middle command must not re-encode the video, but must do a fast copy.
Thanks in advance.