
Recherche avancée
Autres articles (55)
-
MediaSPIP en mode privé (Intranet)
17 septembre 2013, parÀ partir de la version 0.3, un canal de MediaSPIP peut devenir privé, bloqué à toute personne non identifiée grâce au plugin "Intranet/extranet".
Le plugin Intranet/extranet, lorsqu’il est activé, permet de bloquer l’accès au canal à tout visiteur non identifié, l’empêchant d’accéder au contenu en le redirigeant systématiquement vers le formulaire d’identification.
Ce système peut être particulièrement utile pour certaines utilisations comme : Atelier de travail avec des enfants dont le contenu ne doit pas (...) -
Formulaire personnalisable
21 juin 2013, parCette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire. (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (7306)
-
ffmpeg split by silence (with logic to achieve 12 split segments)
14 mars 2023, par Martinhttps://github.com/MartinBarker/split_by_silence


I am trying to automate the process of splitting a single audio file into 12 tracks. you can see in the below image that this 35:62 length mp3 file has 11 visible split points (where the audio more quiet), which means 12 distinct segments.



I'd like to be able to run a script to automatically find these split points and split my file, my first split point should be around
159
seconds, and second around360
, third around540
, 4th around780
, 5th around960
, and so on for a total of 11 split points :

1 159
2 360
3 540
4 780
5 960
6 1129
7 1309
8 1500
9 1680
10 1832
11 1980



but my test results have not been working so good :


- Goal:
11 split points found
12 tracks rendered

- Test 1
SD_PARAMS="-24dB"
MIN_FRAGMENT_DURATION="3"
5 split points found: 361.212,785.811,790.943,969.402,2150.24`
6 tracks rendered

-Test 2
SD_PARAMS="-24dB"
MIN_FRAGMENT_DURATION="3"
10 split points found: 151.422,155.026,158.526,361.212,534.254,783.667,967.253,1128.91,2150.2
11 tracks rendered



- 

- Test 2 Problem :
Even though 12 tracks were rendered, some split points are very close


leading to tracks being exported that are very short, such as 3, 5, and 2 seconds. as well as one long track being 16 minutes





So I added a variable
MIN_SEGMENT_LENGTH
and ran another test

- Test 3
SD_PARAMS="-18dB"
MIN_FRAGMENT_DURATION="3"
MIN_SEGMENT_LENGTH=120 (02:00)

log:
_______________________
Determining split points...
split points list= 150.482,155.026,158.526,361.212,530.019,534.254,783.667,967.245,1127.67,2144.57,2150.2
1. The difference between 150.482 and 155.026 is 4.544
 diff is less than MIN_SEGMENT_LENGTH=120
2. The difference between 155.026 and 158.526 is 3.500
 diff is less than MIN_SEGMENT_LENGTH=120
3. The difference between 158.526 and 361.212 is 202.686
4. The difference between 361.212 and 530.019 is 168.807
5. The difference between 530.019 and 534.254 is 4.235
 diff is less than MIN_SEGMENT_LENGTH=120
6. The difference between 534.254 and 783.667 is 249.413
7. The difference between 783.667 and 967.245 is 183.578
8. The difference between 967.245 and 1127.67 is 160.425
9. The difference between 1127.67 and 2144.57 is 1016.90
10. The difference between 2144.57 and 2150.2 is 5.63
 diff is less than MIN_SEGMENT_LENGTH=120
_______________________
Exporting 12 tracks with ffmpeg...



I'm unsure how to change my script and vars so that by running it, are calculating the split points, if any of them are too short (less then 120 seconds) to regenerate the split point(s) ?


Here is my audio file :
https://filetransfer.io/data-package/HC7GG07k#link


And here is my script, which can be ran by running
./split_by_silence.sh


# -----------------------
# SPLIT BY SILENCE
# Requirements:
# ffmpeg
# $ apt-get install bc
# How To Run:
# $ ./split_by_silence.sh "full_lowq.flac" %03d_output.flac

# output title format
OUTPUTTITLE="%03d_output.mp3"
# input audio filepath
IN="/mnt/e/martinradio/rips/vinyl/L.T.D. – Gittin' Down/lowquality_example.mp3"
# output audio filepath
OUTPUTFILEPATH="/mnt/e/folder/rips"
# ffmpeg option: split input audio based on this silencedetect value
SD_PARAMS="-18dB"
# split option: minimum fragment duration
MIN_FRAGMENT_DURATION=3
# minimum segment length
MIN_SEGMENT_LENGTH=120

# -----------------------
# step: ffmpeg
# goal: 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 "split points list= $SPLITS"
# determine if the difference between any two splits is less than MIN_SEGMENT_LENGTH seconds
IFS=',' read -ra VALUES <<< "$SPLITS"

for (( i=0; i<${#VALUES[@]}-1; i++ )); do
 diff=$(echo "${VALUES[$i+1]} - ${VALUES[$i]}" | bc)
 display_i=$((i+1))
 echo "$display_i. The difference between ${VALUES[$i]} and ${VALUES[$i+1]} is $diff"
 if (( $(echo "$diff < $MIN_SEGMENT_LENGTH" | bc -l) )); then
 echo " diff is less than MIN_SEGMENT_LENGTH=$MIN_SEGMENT_LENGTH"
 fi
done


# using the split points list, calculate how many output audio files will be created 
num=0
res="${SPLITS//[^,]}"
CHARCOUNT="${#res}"
num=$((CHARCOUNT + 2))
echo "_______________________"
echo "Exporting $num tracks with ffmpeg"

ffmpeg -i "$IN" -c copy -map 0 -f segment -segment_times "$SPLITS" "$OUTPUTFILEPATH/$OUTPUTTITLE"

echo "Done."




- Test 2 Problem :
Even though 12 tracks were rendered, some split points are very close

-
No video steam played with the ffmpeg script from avi to mp4 on Centos 8.2/ffmpeg 8 [duplicate]
27 septembre 2020, par user27240The mp4 file that was transformed from the avi file with the script below running on Centos 8.2/ffmpeg gcc 8 does not play video stream and it only play audio on chrome/edge/firefox/opera and Windows10.
Could anyone please help me out ?


for i in /var/www/html/xxxxx/xxxxx/479.AVI; do ffmpeg -i "$i" -pix_fmt yuv420p -movflags +faststart -ss 0.03 "/var/www/html/xxxxx/xxxxx/$(basename "$i" .avi).mp4"; done


The log for the ffmpeg transform script :


peg -i "$i" -pix_fmt yuv420p -movflags +faststart -ss 0.03 "/var/www/html/xxxxx/xxxxx/$(basename "$i" .avi).mp4"; done
ffmpeg version N-99260-g6401a5d4b8 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 8 (GCC)
 configuration: --disable-x86asm
 libavutil 56. 59.100 / 56. 59.100
 libavcodec 58.106.100 / 58.106.100
 libavformat 58. 58.100 / 58. 58.100
 libavdevice 58. 11.102 / 58. 11.102
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from '/var/www/html/xxxxx/xxxxx/479.AVI':
 Metadata:
 creation_time : 1980-01-01 00:00:18
 encoder : CanonMVI06
 Duration: 00:00:04.63, start: 0.000000, bitrate: 15522 kb/s
 Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470 bg/unknown/unknown), 640x480, 14916 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
 Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
 Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x37e3c80] deprecated pixel format used, make sure you did set range correctly
Output #0, mp4, to '/var/www/html/xxxxx/xxxxx/479.AVI.mp4':
 Metadata:
 encoder : Lavf58.58.100
 Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x480, q=2-31, 200 kb/s, 30 fps, 65521 tbn, 30 tbc
 Metadata:
 encoder : Lavc58.106.100 mpeg4
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
 Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 k b/s
 Metadata:
 encoder : Lavc58.106.100 aac
frame= 61 fps=0.0 q=24.8 size= 0kB time=00:00:02.90 bitrate= 0.1kbits/ frame= 126 fps=125 q=31.0 size= 256kB time=00:00:04.55 bitrate= 460.9kbits/ [mp4 @ 0x376e700] Starting second pass: moving the moov atom to the beginning of the file
frame= 138 fps=125 q=31.0 Lsize= 379kB time=00:00:04.62 bitrate= 671.2kbits /s speed=4.17x
video:335kB audio:38kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.401716%
[aac @ 0x377d2c0] Qavg: 2088.382



ffmpeg version :


ffmpeg version N-99260-g6401a5d4b8 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (GCC)
configuration: --disable-x86asm
libavutil 56. 59.100 / 56. 59.100
libavcodec 58.106.100 / 58.106.100
libavformat 58. 58.100 / 58. 58.100
libavdevice 58. 11.102 / 58. 11.102
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100



CentOS version :

CentOS Linux release 8.2.2004 (Core)


Clinet OS :

Windows10


Browsers :

Chrome, Edge, Firefox, Opera


ffprobe -loglevel error :


[root@xxxxxxx xxxxxxx]# ffprobe -loglevel error -show_streams 479.AVI.mp4 
[STREAM]
index=0
codec_name=mpeg4
codec_long_name=MPEG-4 part 2
profile=Simple Profile
codec_type=video
codec_time_base=2184/65521
codec_tag_string=mp4v
codec_tag=0x7634706d
width=640
height=480
coded_width=640
coded_height=480
closed_captions=0
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=1
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
quarter_sample=false
divx_packed=false
id=N/A
r_frame_rate=65521/2184
avg_frame_rate=65521/2184
time_base=1/65521
start_pts=0
start_time=0.000000
duration_ts=301392
duration=4.599930
bit_rate=596840
max_bit_rate=596840
bits_per_raw_sample=N/A
nb_frames=138
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=202992
duration=4.602993
bit_rate=67677
max_bit_rate=69000
bits_per_raw_sample=N/A
nb_frames=200
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=SoundHandler
[/STREAM]



-
Audio recorded with MediaRecorder on Chrome missing duration
3 juin 2017, par suppp111I am recording audio (oga/vorbis) files with MediaRecorder. When I record these file through Chrome I get problems : I cannot edit the files on ffmpeg and when I try to play them on Firefox it says they are corrupt (they do play fine on Chrome though).
Looking at their metadata on ffmpeg I get this :
Input #0, matroska,webm, from '91.oga':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
[STREAM]
index=0
codec_name=opus
codec_long_name=Opus (Opus Interactive Audio Codec)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=eng
[/STREAM]
[FORMAT]
filename=91.oga
nb_streams=1
nb_programs=0
format_name=matroska,webm
format_long_name=Matroska / WebM
start_time=0.000000
duration=N/A
size=7195
bit_rate=N/A
probe_score=100
TAG:encoder=ChromeAs you can see there are problems with the duration. I have looked at posts like this :
How can I add predefined length to audio recorded from MediaRecorder in Chrome ?But even trying that, I got errors when trying to chop and merge files.For example when running :
ffmpeg -f concat -i 89_inputs.txt -c copy final.oga
I get a lot of this :
[oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57612, current: 1980; changing to 57613. This may result in incorrect timestamps in the output file.
[oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57613, current: 2041; changing to 57614. This may result in incorrect timestamps in the output file.
DTS -442721849179034176, next:42521 st:0 invalid dropping
PTS -442721849179034176, next:42521 invalid dropping st:0
[oga @ 00000000006789c0] Non-monotonous DTS in output stream 0:0; previous: 57614, current: 2041; changing to 57615. This may result in incorrect timestamps in the output file.
[oga @ 00000000006789c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
DTS -442721849179031296, next:42521 st:0 invalid dropping
PTS -442721849179031296, next:42521 invalid dropping st:0Does anyone know what we need to do to audio files recorded from Chrome for them to be useful ? Or is there a problem with my setup ?
Recorder js :
if (navigator.getUserMedia) {
console.log('getUserMedia supported.');
var constraints = { audio: true };
var chunks = [];
var onSuccess = function(stream) {
var mediaRecorder = new MediaRecorder(stream);
record.onclick = function() {
mediaRecorder.start();
console.log(mediaRecorder.state);
console.log("recorder started");
record.style.background = "red";
stop.disabled = false;
record.disabled = true;
var aud = document.getElementById("audioClip");
start = aud.currentTime;
}
stop.onclick = function() {
console.log(mediaRecorder.state);
console.log("Recording request sent.");
mediaRecorder.stop();
}
mediaRecorder.onstop = function(e) {
console.log("data available after MediaRecorder.stop() called.");
var audio = document.createElement('audio');
audio.setAttribute('controls', '');
audio.setAttribute('id', 'audioClip');
audio.controls = true;
var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs="vorbis"' });
chunks = [];
var audioURL = window.URL.createObjectURL(blob);
audio.src = audioURL;
sendRecToPost(blob); // this just send the audio blob to the server by post
console.log("recorder stopped");
}