
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (55)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (7248)
-
How to add a subtitle to a video using ffmpeg in Flutter ?
3 juillet 2024, par Mohammed BekeleI'm using flutter_ffmpeg_kit_full package to add subtitles to my video. First I loop through all words and create an srt file and stored it in temp folder :


Future<string> _createSrtFile() async {
 String filePath = await getSrtOutputFilePath();

 final file = File(filePath);
 final buffer = StringBuffer();

 for (int i = 0; i < widget.words.length; i++) {
 final word = widget.words[i];
 final startTime = _formatSrtTime(word['startTime'].toDouble());
 final endTime = _formatSrtTime(word['endTime'].toDouble());
 final text = word['word'];

 buffer.writeln('${i + 1}');
 buffer.writeln('$startTime --> $endTime');
 buffer.writeln('$text');
 buffer.writeln('');
 }

 await file.writeAsString(buffer.toString());
 return filePath;
 }

 String _formatSrtTime(double seconds) {
 final int hours = seconds ~/ 3600;
 final int minutes = ((seconds % 3600) ~/ 60);
 final int secs = (seconds % 60).toInt();
 final int millis = ((seconds - secs) * 1000).toInt() % 1000;

 return '${hours.toString().padLeft(2, '0')}:${minutes.toString().padLeft(2, '0')}:${secs.toString().padLeft(2, '0')},${millis.toString().padLeft(3, '0')}';
 }
</string>


Then I create a future function to handle the export by using ffmpeg command :


Future<void> _exportVideo() async {
 final hasPermission = await _requestStoragePermission();
 if (!hasPermission) {
 ScaffoldMessenger.of(context).showSnackBar(
 const SnackBar(content: Text('Storage permission denied')));
 return;
 }

 setState(() {
 _isProcessing = true;
 _outputFilePath = "";
 });

 try {
 final srtFilePath = await _createSrtFile();

 String videoPath = widget.videoFile!.path;

 String _outputPath = await getOutputFilePath();

 final command =
 '-i $videoPath -vf "drawtext="text=\'Stack Overflow\':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2"" -codec:a copy $_outputPath';

 // final cmd = [
 // '-i',
 // videoPath,
 // '-preset',
 // 'ultrafast',
 // '-vf',
 // 'subtitles=$srtFilePath:force_style=\'Fontname=Roboto Bold,FontSize=30,MarginV=70,PrimaryColour=ffffff,OutlineColour=000000\'',
 // _outputPath
 // ];
 // FFmpegKit.executeWithArguments(cmd)

 print('Executing FFmpeg command: $command');

 await FFmpegKit.execute(command).then((session) async {
 final returnCode = await session.getReturnCode();
 final output = await session.getOutput();
 final failStackTrace = await session.getFailStackTrace();

 print('FFmpeg Output: $output');
 if (failStackTrace != null) {
 print('FFmpeg Fail StackTrace: $failStackTrace');
 }

 if (ReturnCode.isSuccess(returnCode)) {
 setState(() {
 _outputFilePath = _outputPath;
 });
 ScaffoldMessenger.of(context).showSnackBar(
 const SnackBar(content: Text('Export successful!')));
 } else {
 final logs = await session.getLogsAsString();
 print('FFmpeg Logs: $logs');
 ScaffoldMessenger.of(context)
 .showSnackBar(const SnackBar(content: Text('Export failed!')));
 }
 });
 } catch (e) {
 print('Error: $e');
 ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(content: Text('Export failed with error: $e')));
 } finally {
 setState(() {
 _isProcessing = false;
 });
 }
 }
</void>


I did the export without the subtitles and it works. but the issue is when I try to do it with subtitles. I don't know what fault I'm making but this code is failing to export. Here is the path for the srt and video itself :


Future<string> getOutputFilePath() async {
 final Directory? downloadsDir = await getDownloadsDirectory();
 final timestamp = DateTime.now().millisecondsSinceEpoch;
 final name = "output-$timestamp.avi";
 return '${downloadsDir!.path}/$name'; // Save in downloads folder
 }

 Future<string> getSrtOutputFilePath() async {
 final Directory? downloadsDir = await getDownloadsDirectory();
 final timestamp = DateTime.now().millisecondsSinceEpoch;
 final name = "caption-$timestamp.srt";
 return '${downloadsDir!.path}/$name'; // Save in downloads folder
 }
</string></string>


-
Batch script cannot read file if there is a space
25 août 2022, par ShahpariCD "C:\Input"
for %%a in ("*.*") do "C:\ffmpeg.exe" -i %%a -map 0:v -map 0:a:0 -map 0:s -c:v copy -c:a ac3 -b:a 640K "C:\Out\%%~na.mkv"
pause



if there is no space this script works fine, but if there is a space in file name, the script reads only the first word of the file and throws an error. i tried to add a double quote first %%a. but then the script does not even run.


here is an example file name :

[TEST] ABC test - 99


-
not able to convert a specific .wav file to mp3 or m4a with sox, avconv
25 juillet 2017, par astrographAt the office we have a project where we apply IoT technologies to a real bee hive.
One of the features is to detect specific sounds the bees make when a new queen hatches. We have a special microphone in place, the algorithm is also implemented. For now we get a lot of false positives, and want to quickly be able to identify them, by listening to the audio files in the browser. Therefore I want to convert the .wav files to either .mp3 or .m4a
The .wav file format seems to be quite strange, as I was not able to convert it to mp3 using avconv, sox or even audacity. The funny thing is, the Microsoft media player can play the .wav file fine.
Here is the information soxi gives about the wav file :
pi@raspberrypi:~ $ soxi Channel1.wav
soxi WARN wav: wave header missing extended part of fmt chunk
Input File : 'Channel1.wav'
Channels : 1
Sample Rate : 6250
Precision : 24-bit
Duration : 00:01:21.00 = 506250 samples ~ 6075 CDDA sectors
File Size : 2.03M
Bit Rate : 200k
Sample Encoding: 32-bit Floating Point PCMThis is the avconv command I am trying to use :
avconv -y -v quiet -i Channel1.wav -strict experimental -ar 44100 -ab 160k Channel1.m4a
I also tried with sox :
sox -v 0.60 Channel1.wav -r 22050 Channel1.m4a
but the output is mostly silent, with some random noise.
The question is how can a wav file like this : https://drive.google.com/open?id=0B9YVh-jkOMLsQThERlI2emN2QWM be converted to an audio format using a raspberry pi that can be played in the browser ?