
Recherche avancée
Médias (91)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (102)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (9220)
-
NodeJS SpeechRecorder pipe to child process ffmpeg encoder - dest.on is not a function
10 décembre 2022, par Matthew SwaringenTrying to make a utility to help me with recording words for something. Unfortunately getting stuck on the basics.


The error I get when I hit s key and talk enough to fill the buffer is


terminate called after throwing an instance of 'Napi::Error'
 what(): dest.on is not a function
[1] 2298218 IOT instruction (core dumped) node record.js



Code is below. I can write the wav file and then encode that but I'd rather not have to have an intermediate file unless there is no way around it, and I can't imagine that is the case.


const { spawn } = require('child_process');
const { writeFileSync } = require('fs');
const readline = require('readline');
const { SpeechRecorder } = require('speech-recorder');
const { WaveFile } = require('wavefile');

let paused = true;

const ffmpeg = spawn('ffmpeg', [
 // '-f', 's16', // input format
 //'-sample_rate', '16000',
 '-i', '-', // input source
 '-c:a', 'libvorbis', // audio codec 
 'output.ogg', // output file 
 '-y'
]);

let buffer = [];
const recorder = new SpeechRecorder({
 onAudio: ({ audio, speech }) => {
 //if(speech) {

 for (let i = 0; i < audio.length; i++) {
 buffer.push(audio[i]);
 }

 if(buffer.length >= 16000 * 5) { 
 console.log('piping to ffmpeg for output');
 let wav = new WaveFile()
 wav.fromScratch(1,16000,"16",buffer);
 //writeFileSync('output.wav',wav.toBuffer());
 ffmpeg.stdin.pipe(buffer, {end: false});
 }
 //}
 }
});

// listen for keypress events
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);

process.stdin.on('keypress', (str, key) => {
 if (key.name === 's') {
 // pause or resume recording
 paused = !paused;
 if(paused) { recorder.stop(); } else { recorder.start(); }

 
 } else if (key.ctrl && key.name === 'c') {
 // exit program
 ffmpeg.kill('SIGINT'); 
 process.exit();
 }
});



-
Use C# to converting apng to webm with ffmpeg from pipe input and output
30 novembre 2022, par martin wangI was using ffmpeg to convert Line sticker from apng file to webm file.
And the result is weird, some of them was converted successed and some of them failed.
not sure what happend with these failed convert.


Here is my c# code to convert Line sticker to webm,
and I use CliWrap to run ffmpeg command line.


async Task Main()
{

 var downloadUrl = @"http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip";
 var arg = @$"-i pipe:.png -vf scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos -pix_fmt yuva420p -c:v libvpx-vp9 -cpu-used 5 -minrate 50k -b:v 350k -maxrate 450k -to 00:00:02.900 -an -y -f webm pipe:1";

 var errorCount = 0;
 try
 {
 using (var hc = new HttpClient())
 {
 var imgsZip = await hc.GetStreamAsync(downloadUrl);

 using (ZipArchive zipFile = new ZipArchive(imgsZip))
 {
 var files = zipFile.Entries.Where(entry => Regex.IsMatch(entry.FullName, @"animation@2x\/\d+\@2x.png"));
 foreach (var entry in files)
 {
 try
 {
 using (var fileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}.webm")))
 using (var pngFileStream = File.Create(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{entry.Name}")))
 using (var entryStream = entry.Open())
 using (MemoryStream ms = new MemoryStream())
 {
 entry.Open().CopyTo(pngFileStream);

 var result = await Cli.Wrap("ffmpeg")
 .WithArguments(arg)
 .WithStandardInputPipe(PipeSource.FromStream(entryStream))
 .WithStandardOutputPipe(PipeTarget.ToStream(ms))
 .WithStandardErrorPipe(PipeTarget.ToFile(Path.Combine("D:", "Projects", "ffmpeg", "Temp", $"{Path.GetFileNameWithoutExtension(entry.Name)}Info.txt")))
 .WithValidation(CommandResultValidation.ZeroExitCode)
 .ExecuteAsync();
 ms.Seek(0, SeekOrigin.Begin);
 ms.WriteTo(fileStream);
 }
 }
 catch (Exception ex)
 {
 entry.FullName.Dump();
 ex.Dump();
 errorCount++;
 }
 }
 }

 }
 }
 catch (Exception ex)
 {
 ex.Dump();
 }
 $"Error Count:{errorCount.Dump()}".Dump();

}



This is the failed convert file's error information from ffmpeg :




And the successed convert file from ffmpeg infromation :



It's strange when I was manually converted these failed convert file from command line, and it will be converted successed.



The question is the resource of images are all the same apng file,
so I just can't understan why some of files will convert failed from my c# code
but also when I manually use command line will be converted successed ?



I have written same exampe from C# to Python...
and here is python code :


from io import BytesIO
import os
import re
import subprocess
import zipfile

import requests


downloadUrl = "http://dl.stickershop.LINE.naver.jp/products/0/0/1/23303/iphone/stickerpack@2x.zip"
args = [
 'ffmpeg',
 '-i', 'pipe:',
 '-vf', 'scale=512:512:force_original_aspect_ratio=decrease:flags=lanczos',
 '-pix_fmt', 'yuva420p',
 '-c:v', 'libvpx-vp9',
 '-cpu-used', '5',
 '-minrate', '50k',
 '-b:v', '350k',
 '-maxrate', '450k', '-to', '00:00:02.900', '-an', '-y', '-f', 'webm', 'pipe:1'
]


imgsZip = requests.get(downloadUrl)
with zipfile.ZipFile(BytesIO(imgsZip.content)) as archive:
 files = [file for file in archive.infolist() if re.match(
 "animation@2x\/\d+\@2x.png", file.filename)]
 for entry in files:
 fileName = entry.filename.replace(
 "animation@2x/", "").replace(".png", "")
 rootPath = 'D:\\' + os.path.join("Projects", "ffmpeg", "Temp")
 # original file
 apngFile = os.path.join(rootPath, fileName+'.png')
 # output file
 webmFile = os.path.join(rootPath, fileName+'.webm')
 # output info
 infoFile = os.path.join(rootPath, fileName+'info.txt')

 with archive.open(entry) as file, open(apngFile, 'wb') as output_apng, open(webmFile, 'wb') as output_webm, open(infoFile, 'wb') as output_info:
 p = subprocess.Popen(args, stdin=subprocess.PIPE,
 stdout=subprocess.PIPE, stderr=output_info)
 outputBytes = p.communicate(input=file.read())[0]

 output_webm.write(outputBytes)
 file.seek(0)
 output_apng.write(file.read())




And you can try it,the result will be the as same as C#.


-
How to pipe HLS segment to numpy array with FFmpeg
22 novembre 2022, par urico12I'm trying to extract a clip from an HLS stream and pipe the output to a numpy array. When I set the ffmpeg process to output to an mp4 file, the video looks exactly as I expect it to. However, when I output to a pipe so that I can add the data to a numpy array, the resulting video's display is off.


I'm running this ffmpeg command as a subprocess in python. I retrieve the output and send it to videowriter to create the mp4. I'm only doing the second part at the moment to test that the video data is correct.


clip_command = f"ffmpeg -y -live_start_index 0 -i master.m3u8 -ss {start} -t {duration} -pix_fmt rgb24 -f rawvideo pipe:1"
generate_clip = Popen(clip_command, shell=True, stdout=PIPE, stderr=STDOUT, bufsize=10**8)

nb_img = 300*300*3
out = cv2.VideoWriter('output.mp4', cv2.VideoWriter_fourcc(*'mp4v'), 15, (300, 300))
while True:
 buffer = generate_clip.stdout.read(nb_img)
 if len(buffer) != nb_img:
 # last frame
 break
 img = np.frombuffer(buffer, dtype='uint8').reshape(300, 300, 3)
 out.write(img)
out.release()



When I view the video that is generated frm cv2.VideoWriter, it looks something like
this.
The colors are changed from the source video and the frame repeats near the edges. I've tried setting different values for -pix_fmt but nothing seems to help. I'm not sure what I'm doing wrong or if what I'm trying to do is even feasible with Ffmpeg because I haven't been able to find much information on this particular use case.