
Recherche avancée
Autres articles (12)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
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 (6846)
-
React Native (Android) : Download mp3 file
21 février 2024, par Batuhan FındıkI get the youtube video link from the ui. I download the video from this link and convert it to mp3. I download it to my phone as mp3. The song opens on WhatsApp on the phone. but it doesn't open on the mp3 player. The song is not broken because it opens on WhatsApp too. Why do you think the mp3 player doesn't open ? Could it be from the file information ? I tried to enter some file information but it still won't open. For example, there is from information in songs played on an mp3 player. There is no from information in my song file. I tried to add it but it wasn't added.


.net 8 api return :


[HttpPost("ConvertVideoToMp3")]
public async Task<iactionresult> ConvertVideoToMp3(Mp3 data)
{
 try
 {
 string videoId = GetYoutubeVideoId(data.VideoUrl);

 var streamInfoSet = await _youtubeClient.Videos.Streams.GetManifestAsync(videoId);
 var videoStreamInfo = streamInfoSet.GetAudioOnlyStreams().GetWithHighestBitrate();

 if (videoStreamInfo != null)
 {
 var videoStream = await _youtubeClient.Videos.Streams.GetAsync(videoStreamInfo);
 var memoryStream = new MemoryStream();

 await videoStream.CopyToAsync(memoryStream);
 memoryStream.Seek(0, SeekOrigin.Begin);

 var videoFilePath = $"{videoId}.mp4";
 await System.IO.File.WriteAllBytesAsync(videoFilePath, memoryStream.ToArray());

 var mp3FilePath = $"{videoId}.mp3";
 var ffmpegProcess = Process.Start(new ProcessStartInfo
 {
 FileName = "ffmpeg",
 Arguments = $"-i \"{videoFilePath}\" -vn -acodec libmp3lame -ab 128k -id3v2_version 3 -metadata artist=\"YourArtistName\" -metadata title=\"YourTitle\" -metadata from=\"youtube\" \"{mp3FilePath}\"",
 RedirectStandardError = true,
 UseShellExecute = false,
 CreateNoWindow = true
 });

 await ffmpegProcess.WaitForExitAsync();

 var file = TagLib.File.Create(mp3FilePath);

 
 file.Tag.Artists = new string [] { "YourArtistName"};
 file.Tag.Title = "YourTitle";
 file.Tag.Album = "YourAlbumName"; 
 file.Tag.Comment = "Source: youtube";
 

 file.Save();

 var mp3Bytes = await System.IO.File.ReadAllBytesAsync(mp3FilePath);

 System.IO.File.Delete(videoFilePath);
 System.IO.File.Delete(mp3FilePath);

 return File(mp3Bytes, "audio/mpeg", $"{videoId}.mp3");
 }
 else
 {
 return NotFound("Video stream not found");
 }
 }
 catch (Exception ex)
 {
 return StatusCode(500, $"An error occurred: {ex.Message}");
 }
}
</iactionresult>


React Native :


const handleConvertAndDownload = async () => {
 try {
 const url = 'http://192.168.1.5:8080/api/Mp3/ConvertVideoToMp3';
 const fileName = 'example';
 const newFileName = generateUniqueSongName(fileName);
 const filePath = RNFS.DownloadDirectoryPath + '/'+newFileName;

 fetch(url, {
 method: 'POST',
 headers: {
 'Content-Type': 'application/json',
 },
 body: JSON.stringify({videoUrl:videoUrl}),
 })
 .then((response) => {
 if (!response.ok) {
 Alert.alert('Error', 'Network');
 throw new Error('Network response was not ok');
 }
 return response.blob();
 })
 .then((blob) => {
 return new Promise((resolve, reject) => {
 const reader = new FileReader();
 reader.onloadend = () => {
 resolve(reader.result.split(',')[1]); 
 };
 reader.onerror = reject;
 reader.readAsDataURL(blob);
 });
 })
 .then((base64Data) => {
 // Dosyanın varlığını kontrol et
 return RNFS.exists(filePath)
 .then((exists) => {
 if (exists) {
 console.log('File already exists');
 return RNFS.writeFile(filePath, base64Data, 'base64', 'append');
 } else {
 console.log('File does not exist');
 return RNFS.writeFile(filePath, base64Data, 'base64');
 }
 })
 .catch((error) => {
 console.error('Error checking file existence:', error);
 throw error;
 });
 })
 .then(() => {
 Alert.alert('Success', 'MP3 file downloaded successfully.');
 console.log('File downloaded successfully!');
 })
 .catch((error) => {
 Alert.alert('Error', error.message);
 console.error('Error downloading file:', error);
 });
 } catch (error) {
 Alert.alert('Error', error.message);
 console.error(error);
 }
 };



-
Is there a way to program the (Download) button to save a group of images as a one video ?
9 février 2024, par Lina Al-fawzanThis is my entire code. Its function is that everything the user writes or says will have images returned to him according to what he wrote/said, and the next image will be shown to him after he presses “close,” and he can save each image separately. I want to make a simple modification to it. First, instead of a close button, I want each image to be displayed for 3 seconds and the next one to be displayed, and so on... “all of them in one window”, and for the “download” button to be when the last image is displayed, and for them all to be saved in one video.


import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'dart:convert';
import 'dart:typed_data';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;

void main() {
 runApp(MyApp());
}

class MyApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return MaterialApp(
 home: MyHomePage(),
 );
 }
}

class MyHomePage extends StatefulWidget {
 @override
 _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<myhomepage> {
 TextEditingController _textEditingController = TextEditingController();
 late stt.SpeechToText _speech;
 bool _isListening = false;

 @override
 void initState() {
 super.initState();
 _speech = stt.SpeechToText();
 }

 void _listen() async {
 if (!_isListening) {
 bool available = await _speech.initialize(
 onStatus: (val) => print('onStatus: $val'),
 onError: (val) => print('onError: $val'),
 );
 if (available) {
 setState(() => _isListening = true);
 _speech.listen(
 onResult: (val) => setState(() {
 _textEditingController.text = val.recognizedWords;
 if (val.hasConfidenceRating && val.confidence > 0) {
 _showImages(val.recognizedWords);
 }
 }),
 );
 }
 } else {
 setState(() => _isListening = false);
 _speech.stop();
 }
 }

 @override
 Widget build(BuildContext context) {
 return Scaffold(
 appBar: AppBar(
 title: Text('Image Viewer'),
 ),
 body: Padding(
 padding: const EdgeInsets.all(16.0),
 child: Column(
 mainAxisAlignment: MainAxisAlignment.center,
 children: [
 TextField(
 controller: _textEditingController,
 decoration: const InputDecoration(
 labelText: 'Enter a word',
 ),
 ),
 SizedBox(height: 16.0),
 ElevatedButton(
 onPressed: () {
 String userInput = _textEditingController.text;
 _showImages(userInput);
 },
 child: Text('Show Images'),
 ),
 SizedBox(height: 16.0),
 ElevatedButton(
 onPressed: _listen,
 child: Text(_isListening ? 'Stop Listening' : 'Start Listening'),
 ),
 ],
 ),
 ),
 );
 }

Future<void> _showImages(String userInput) async {
 String directoryPath = 'assets/output_images/';
 print("User Input: $userInput");
 print("Directory Path: $directoryPath");

 List<string> assetFiles = await rootBundle
 .loadString('AssetManifest.json')
 .then((String manifestContent) {
 final Map manifestMap = json.decode(manifestContent);
 return manifestMap.keys
 .where((String key) => key.startsWith(directoryPath))
 .toList();
 });

 List<string> imageFiles = assetFiles.where((String assetPath) =>
 assetPath.toLowerCase().endsWith('.jpg') ||
 assetPath.toLowerCase().endsWith('.gif')).toList();

 List<string> words = userInput.split(' '); // Tokenize the sentence into words

 for (String word in words) {
 String wordImagePath = '$directoryPath$word.gif';

 if (imageFiles.contains(wordImagePath)) {
 await _showDialogWithImage(wordImagePath);
 } else {
 for (int i = 0; i < word.length; i++) {
 String letter = word[i];
 String letterImagePath = imageFiles.firstWhere(
 (assetPath) => assetPath.toLowerCase().endsWith('$letter.jpg'),
 orElse: () => '',
 );
 if (letterImagePath.isNotEmpty) {
 await _showDialogWithImage(letterImagePath);
 } else {
 print('No image found for $letter');
 }
 }
 }
 }
}

 

 Future<void> _showDialogWithImage(String imagePath) async {
 await showDialog<void>(
 context: context,
 builder: (BuildContext context) {
 return AlertDialog(
 content: Image.asset(imagePath),
 actions: [
 TextButton(
 onPressed: () {
 Navigator.of(context).pop();
 },
 child: Text('Close'),
 ),
 TextButton(
 onPressed: () async {
 await _downloadImage(imagePath);
 Navigator.of(context).pop();
 },
 child: Text('Download'),
 ),
 ],
 );
 },
 );
 }

 Future<void> _downloadImage(String assetPath) async {
 try {
 final ByteData data = await rootBundle.load(assetPath);
 final List<int> bytes = data.buffer.asUint8List();

 final result = await ImageGallerySaver.saveImage(Uint8List.fromList(bytes));

 if (result != null) {
 ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(
 content: Text('Image saved to gallery.'),
 ),
 );
 } else {
 ScaffoldMessenger.of(context).showSnackBar(
 SnackBar(
 content: Text('Failed to save image to gallery.'),
 ),
 );
 }
 } catch (e) {
 print('Error downloading image: $e');
 }
 }
}

</int></void></void></void></string></string></string></void></myhomepage>


-
Java merge ? mix ? 2 audio files(mp3) parallely and download it
11 février 2024, par JoonSeo Yangis there any way to mix 2 audio files parallely and let user download it ?


I was trying it by ffmpeg


String audioInputPath1 = "sample_audio1.wav";
String audioInputPath2 = "sample_audio2.wav";
String outputFilePath1 = "filePath";
FFmpeg ffmpeg = new FFmpeg("C:\\filePath\\ffmpeg-master-latest-win64-gpl\\ffmpeg-master-latest-win64-gpl\\bin\\ffmpeg.exe");
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg);
FFprobe ffprobe = new FFprobe("C:\\filePath\\ffmpeg-master-latest-win64-gpl\\ffmpeg-master-latest-win64-gpl\\bin\\ffprobe.exe");

FFmpegProbeResult probeResult = ffprobe.probe(audioInputPath1);
FFmpegProbeResult probeResult2 = ffprobe.probe(audioInputPath2);

FFmpegBuilder builder = new FFmpegBuilder()
.overrideOutputFiles(true)
.setInput(audioInputPath2)
.addInput(audioInputPath1)
.addOutput(outputFilePath2)
.setFormat("wav")
.setAudioCodec("libmp3lame")
.setAudioBitRate(256000)
.done();

executor.createJob(builder).run();



after i run this code, i get proper .wav file at my outputfilepath, but what i get is just same copy of sample_audio2.wav. no concat, or merged with sample_audio1.wav can i get any help on this problem ??