
Recherche avancée
Autres articles (52)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (11350)
-
Recording audio with MediaRecorder on iPhone with Safari and Chrome only 1 second long ? Mimetype and FFMPEG problem ?
9 mai 2023, par AvatarI am using MediaRecorder to record the Microphone audio on a website.


Javascript :


var blob;
var blob_url;
var stream;
var recorder;
var chunks;

var media = {
 tag: 'audio',
 type: 'audio/ogg',
 ext: '.ogg',
 gUM: {audio: true}
};

navigator.mediaDevices.getUserMedia(media.gUM).then(_stream => 
{
 stream = _stream;

 recorder = new MediaRecorder(stream);

 recorder.ondataavailable = e => 
 {
 // push data to chunks
 chunks.push(e.data);

 // recording has been stopped
 if(recorder.state == 'inactive') 
 {
 // audio data available
 blob = new Blob(chunks, {type: media.type });
 blob_url = URL.createObjectURL(blob);
 
 // send data to server
 uploadfile_audio();
 }
 };

 if(typeof(recorder)=='undefined')
 {
 alert('No microphone access');
 return;
 }

 chunks = [];
 recorder.start();
}


// when stop button is clicked
recorder.stop();
stream.getTracks().forEach( track => track.stop() );



The audio stream (ogg format) is sent to the server.


Since iPad/iPhone do not play ogg files, the recording file is converted to "mp3" using FFMPEG.


This file is stored on the server.



This works on Windows and MAC (Chrome and Safari), also on iPad (Safari) but not properly on iPhone (Chrome/Safari). Version : iPhone iOS 15.1.


On iPhone the recording file is only
0:01 min
in length. Size is always17277
Bytes.

What could be the issue ? (I cannot debug because I don't have a Mac.)


Does the stream get interrupted ? Is the recording stopped after 1 second ?


Update 1 :


I have checked the incoming filesize of the browser-recorded file serverside. It seems to be coming in properly, because there are different sizes such as 184 kB.


My guess is now that FFMPEG cannot handle the incoming file correctly. Which might have the wrong mimetype set in Javascript with
type: 'audio/ogg',
. Is another format needed ?

The conversion code serverside :


PHP


$mp3file = shell_exec("ffmpeg -i ".$file_locationtmp." -vn -ar 44100 -ac 2 -b:a 128k ".$file_locationtmp.".mp3");



I would need to find out the audio recording format used by iPhone but I couldn't.


I tried to find the supporting mimetypes using https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported - however, it shows that NO mimetypes are supported on iPhone (neither in Chrome nor Safari).


Update 2 :


I used
ffprobe
to get the recording file information. It saysStream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 2234 kb/s (default)


Update 3 :


It seems to be a problem with FFMPEG. See my new question How to convert AAC/MP4A to MP3 using FFMPEG in full length ? Audio file gets cut off after 1 second


-
Recording MP3 file from iphone using FFMPEG
16 octobre 2014, par harit shahI am trying to record an mp3 file from iphone. It seems it is not possible so next option I am trying is recording it with aac encoding and convert it with ffmpeg exe to mp3.
I am recording the m4a file with following code :
// Set the audio file
NSArray *pathComponents = [NSArray arrayWithObjects:
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
@"MyAudioMemo.aac",
nil];
NSURL *outputFileURL = [NSURL fileURLWithPathComponents:pathComponents];
// Setup audio session
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
NSMutableDictionary *recordSettings = [[NSMutableDictionary alloc] initWithCapacity:10];
NSNumber *formatObject;
formatObject = [NSNumber numberWithInt: kAudioFormatMPEG4AAC];
[recordSettings setObject:formatObject forKey: AVFormatIDKey];
[recordSettings setObject:[NSNumber numberWithFloat:44100.0] forKey: AVSampleRateKey];
[recordSettings setObject:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
// [recordSettings setObject:[NSNumber numberWithInt:12800] forKey:AVEncoderBitRateKey];
// [recordSettings setObject:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
[recordSettings setObject:[NSNumber numberWithInt: AVAudioQualityHigh] forKey: AVEncoderAudioQualityKey];so when I try to convert it using ffmpeg -i 1.m4a 1.mp3 it says invalid input found while reading 1.m4a. I tried different encoding but everytime I get the same error. Any help on this would be life saving.
Thanks.
-
How to switch between audio streams added using ffmpeg on an iPhone ?
24 décembre 2019, par Tony MI have an
m.mp4
with English audio and want to add a second audio stream in Italian so that I can play either language using the iPhone. When I used this command :ffmpeg -i m.mp4 -i ita.mp3 -c copy -map 0 -map 1 out.mp4
The output from
ffmpeg -i out.mp4
(see below) shows that a new audio stream is added, yet when I transfer the video to the TV app and play it on either MacOS or iOS it only plays the original English and I see no options to play other languages.How do I get it to be able to switch between either audio ?
Here is the output from
ffmpeg -i out.mp4:
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 400x300 [SAR 1:1 DAR 4:3], q=2-31, 482 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 102 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2: Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 152 kb/s
Metadata:
encoder : LAME3.100
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (copy)