
Recherche avancée
Autres articles (32)
-
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 (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (5711)
-
Convert wma stream to mp3 stream with C# and ffmpeg
24 septembre 2012, par user1363468Is it possible to convert a wma stream to an mp3 stream real time ?
I have tried doing something like this but not having any luck :
WebRequest request = WebRequest.Create(wmaUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
int block = 32768;
byte[] buffer = new byte[block];
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.ErrorDialog = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.FileName = "c:\\ffmpeg.exe";
p.StartInfo.Arguments = "-i - -y -vn -acodec libspeex -ac 1 -ar 16000 -f mp3 ";
StringBuilder output = new StringBuilder();
p.OutputDataReceived += (sender, e) =>
{
if (e.Data != null)
{
output.AppendLine(e.Data);
//eventually replace this with response.write code for a web request
}
};
p.Start();
StreamWriter ffmpegInput = p.StandardInput;
p.BeginOutputReadLine();
using (Stream dataStream = response.GetResponseStream())
{
int read = dataStream.Read(buffer, 0, block);
while (read > 0)
{
ffmpegInput.Write(buffer);
ffmpegInput.Flush();
read = dataStream.Read(buffer, 0, block);
}
}
ffmpegInput.Close();
var getErrors = p.StandardError.ReadToEnd();Just wondering if what I am trying to do is even possible (Convert byte blocks of wma to byte blocks of mp3). Open to any other possible C# solutions if they exist.
Thanks
-
Celery to process task and modify the model fields
15 juillet 2015, par RobinI would like to convert video into mp4 using
ffmpeg
andcelery
for the asynchronous task. When user uploads a video, it will be for theoriginal_video
and save it. After that I want celery to convert it into a different version for themp4_720
field. However I am confused on how to apply that logic using celery.app.models.py :
class Video(models.Model):
title = models.CharField(max_length=75)
pubdate = models.DateTimeField(default=timezone.now)
original_video = models.FileField(upload_to=get_upload_file_name)
mp4_720 = models.FileField(upload_to=get_upload_file_name, blank=True, null=True)
converted = models.BooleanField(default=False)app.views.py :
def upload_video(request):
if request.POST:
form = VideoForm(request.POST, request.FILES)
if form.is_valid():
video = form.save(commit=False)
video.save()
// Celery to convert the video
convert_video.delay(video)
return HttpResponseRedirect('/')
else:
form = VideoForm()
return render(request, 'upload_video.html', {
'form':form
})app.tasks.py :
@app.task
def convert_video(video):
// Convert the original video into required format and save it in the mp4_720 field using the following command:
//subprocess.call('ffmpeg -i (path of the original_video) (video for mp4_720)')
// Change the converted boolean field to True
// SaveBasically my question is how to save the converted video in mp4_720. Your help and guidance will be very much appreciated. Thank you.
** update **
What I want that method to do is first convert the video.original_video and then save the converted video in the video.mp4_720 field. If all has been done correctly, change the video.converted to True. How do I define the method to do so ?
-
How to use stdout.write in python3 when piping to ffmpeg ?
10 décembre 2020, par user14644144My main goal for this project I'm working on is to use a python script to get any webcam footage, edit it with opencv, and then pipe the edited video frames with ffmpeg to a dummy webcam from v4l2loopback. Here's the sample code I made that runs exactly as I want to on python 2.7 :




import cv2
import subprocess as sp
import sys

cap = cv2.VideoCapture(1)

cv2.namedWindow('result', cv2.WINDOW_AUTOSIZE)

while True:
 ret, frame = cap.read()
 cv2.imshow('result', frame)

 sys.stdout.write(frame.tostring())

 if cv2.waitKey(1) & 0xFF == ord('q'):
 break

cap.release()
cv2.destroyAllWindows()







and then run it with




python pySample.py | ffmpeg -f rawvideo -pixel_format bgr24 -video_size 640x480 -framerate 30 -i - -vf format=yuv420p -f v4l2 /dev/video17







However, I want it to work with python3 instead of 2.7, and I found a way to make it work where I replace the "sys.stdout..." line with




sys.stdout.buffer.write(frame.tobytes())







This works well, except that it only runs at 14 fps while the 2.7 code could run at 30. I'm kind of at a loss as to how to fix this issue/ what this issue exactly is. I'm running this on a raspberry pi if that helps. Thanks so much !