
Recherche avancée
Autres articles (66)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)
Sur d’autres sites (11532)
-
How to open&save a video file in python ?
27 août 2014, par AliGHI’ve just started to make a ubuntu application using PyGtk. My very first object is to open, convert and then save a video file. Ignoring convert phase, I’m going to implant open-save functions. But at the moment when I open a video file, and save it, I get non-video file with 11B size. I’ve just google this and found OpenCV for python. But I’m not sure if it’s the best way to do it. I also think I’m going to use ffmpeg libraries to do some manipulates on video files. Is it what I want or there might be other built-in libraries ?
By the way, here’s my code to open and save the file :
def on_openFile_clicked(self, widget):
filename=None
dialog = Gtk.FileChooserDialog("Please choose a file", self,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
response = dialog.run()
self.add_filters(dialog)
if response == Gtk.ResponseType.OK:
filename = dialog.get_filename()
elif response == Gtk.ResponseType.CANCEL:
print 'Cancel Clicked'
dialog.destroy()
print "File Choosen: ", filename
def add_filters(self, dialog):
filter_py = Gtk.FileFilter()
filter_py.set_name("Video Files")
filter_py.add_mime_type("video/mp4")
filter_py.add_mime_type("video/x-flv")
dialog.add_filter(filter_py)
filter_any = Gtk.FileFilter()
filter_any.set_name("Any files")
filter_any.add_pattern("*")
dialog.add_filter(filter_any)
def on_saveFile_clicked(self, widget):
filename=None
dialog = Gtk.FileChooserDialog("Please choose a file", self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
response = dialog.run()
self.add_filters(dialog)
if response == Gtk.ResponseType.OK:
filename = dialog.get_filename()
elif response == Gtk.ResponseType.CANCEL:
print 'Cancel Clicked'
dialog.destroy()
if filename != None:
save_file=open(filename, 'w')
save_file.write("Sample Data")
save_file.close()
print "File Saved: ", filename -
How to record an HTML animation and save it as a video, in an automated manner in the backend
14 mai 2022, par frizurdI need to record a webpage and save it as a video, in an automated manner, without human interaction.


I am creating a NodeJS app that generates MP4 videos on the request of the user. The user provides an MP3 file, the app generates animated waveforms for the sound file on top of an illustration.


What I came up with so far is a system that opens a generated web page in the backend, plays the audio file, and shows audio visualization for the audio file on an HTML canvas element. On top of another canvas with mainly static components, such as images, that do not animate. The system records this, the output will be a video file. Finally, I will merge the video file with the sound file to create the final file for the user.


I came up with 2 possible solutions but both of them have problems which I am not able to solve at the moment.



Solution #1


Use a headless browser API such as Phantomjs or Puppeteer to snatch a screenshot x time every second and pipe it to FFmpeg.


The problem


The problem with this is that the process is not realtime. It would work fine if it's JUST an animation but mine is dependant on the audio file. The audio file will play-on during the render which results in a glitchy 1FPS-esque video.


Possible solution ?


Don't play the audio file live but convert the audio file into raw data. Animate the audio visualization based on the raw data instead.
Not sure how to do this and if it's even possible.



Solution #2


Play, record, and save the animation, all in the frontend.
Could use ccapture.js to record and save a canvas.
Use a headless browser to open the page and save it to disk when it's done playing.
Doesn't sound like it's the best solution.


The problem(s)


I have more than 1 canvas.
It takes a while, especially when the audio file is longer than 10 minutes.
Making users wait for a long time can be a deal-breaker.


Possible solution ?


Merge canvases into one.


No idea how to speed up the rendering time and I doubt it's possible this way.


-
Trying to save frames as colored image using Ffmpeg in C++
2 septembre 2021, par TolgaI am new to FFmpeg and I am trying to save the video frames as colored images. I have achieved saving them as grayscale using Netpbm, however, I need to save the frames as colored. I have tried implementing the code in this link.


However, I get an error :


'Exception thrown at 0x00E1FC4F (swscale-5.dll) in VideoDecoding2.exe:
 0xC0000005: Access violation writing location 0xCCCCCCCC.'



Is there any way to improve this code or another way to save frames as colored ?


Here is my code below.


- 

src_pix_fmt
isAV_PIX_FMT_YUV420p
.dst_pix_fmt
isAV_PIX_FMT_RGB24
.






src_pix_fmt = avcc->pix_fmt;

src_width = avcc->width;
src_height = avcc->height;

dst_width = src_width;
dst_height = src_height;

numBytes = av_image_get_buffer_size(dst_pix_fmt, dst_width, dst_height, 0);

buffer = (uint8_t*)av_malloc(numBytes);

if ((ret = av_image_alloc(src_data, src_linesize, src_width, src_height, src_pix_fmt, 16)) < 0)
{
 printf("Couldn't allocate source image.\n");
 return 0;
}

av_image_fill_arrays(frameRGB->data, frameRGB->linesize, buffer, dst_pix_fmt, dst_width, dst_height, 0);

while (av_read_frame(avfc, packet) >= 0)
{
 ret = avcodec_send_packet(avcc, packet);
 if (ret < 0)
 {
 printf("Packets could not supplied to decoder.\n");
 return -1;
 }

 ret = avcodec_receive_frame(avcc, frame);
 printf("%d", ret);

 if (packet->stream_index == videoStream)
 {
 sws_ctx = sws_getContext(src_width, src_height, src_pix_fmt,
 dst_width, dst_height, dst_pix_fmt,
 SWS_BILINEAR, NULL, NULL, NULL);

 if (!sws_ctx)
 {
 printf("Cannot create scale context for conversion\n"
 "fmt:%s s:%dx%d --> fmt:%s s:%dx%d\n",
 av_get_pix_fmt_name(src_pix_fmt), src_width, src_height,
 av_get_pix_fmt_name(dst_pix_fmt), dst_width, dst_height);
 return 0;
 }

 sws_scale(sws_ctx, (const uint8_t* const*)frame->data, frame->linesize, 0, frame->height, dst_data, dst_linesize);

 FILE* f;
 char szFilename[32];
 int y;

 snprintf(szFilename, sizeof(szFilename), "frame%d.ppm", avcc->frame_number);
 fopen_s(&f, szFilename, "wb");
 
 if (f == NULL)
 {
 printf("Couldn't open file.\n");
 return 0;
 }
 
 fprintf(f, "P6\n%d %d\n255\n", dst_width, dst_height);

 for (y = 0; y < dst_height; y++)
 fwrite(frameRGB->data[0] + y * frameRGB->linesize[0], 1, dst_width * 3, f);
 
 fclose(f);
 }
}