
Recherche avancée
Autres articles (62)
-
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
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 (...)
Sur d’autres sites (6186)
-
What is the right way to clean memory in ffmpeg ?
27 mars 2018, par hagorHi i have a class with these fields :
bool m_initializedAndRegistered = false;
std::atomic <bool> m_recievingFrames = false;
int m_init_frames = 10000;
int m_capacity = 10;
std::thread readingThread;
std::string m_streamAdress;
SwsContext *m_img_convert_ctx_ptr = NULL;
AVFormatContext *m_format_ctx_ptr = NULL;
AVFormatContext *m_output_ctx_ptr = NULL;
AVCodecContext *m_codec_ctx_ptr= NULL;// = NULL;
AVPacket m_packet;
AVStream *m_stream_ptr = NULL;
AVCodec *m_codec_ptr = NULL;
AVFrame *m_picture_ptr = NULL;
AVFrame *m_picture_rgb_ptr = NULL;
int m_video_stream_index = -1;
uint8_t *m_picture_buffer_ptr = NULL;
uint8_t *m_picture_buffer_2_ptr = NULL;
circ_buffer m_imageBuffer;
</bool>is it a correct way to clean all memory or do I forget to clean something ?
It seems that I have 0.2 MB memory leak when I do this :m_recievingFrames = false;
readingThread.join();
readingThread.~thread();
while (m_imageBuffer.size() > 0)
{
m_imageBuffer.receive().release();
}
av_packet_unref(&m_packet);
av_frame_free(&m_picture_ptr);
av_frame_free(&m_picture_rgb_ptr);
av_read_pause(m_format_ctx_ptr);
avio_close(m_output_ctx_ptr->pb);
avio_close(m_format_ctx_ptr->pb);
avformat_close_input(&m_format_ctx_ptr);
avformat_close_input(&m_output_ctx_ptr);
avformat_free_context(m_output_ctx_ptr);
avformat_free_context(m_format_ctx_ptr);
m_video_stream_index = -1;
av_free(m_picture_buffer_ptr);
av_free(m_picture_buffer_2_ptr);
avcodec_free_context(&m_codec_ctx_ptr);
av_free(m_stream_ptr);
sws_freeContext(m_img_convert_ctx_ptr);I used malloc in m_picture_buffer_ptr allocation, but I cant free() it, because I get a heap exception. Do I need manually clean all Info for streams as it is suggested here ?
My work is based on this old ffmpeg streamer.
I don’t do av_register_all() and avformat_network_init() on every streamer restart.
What is a good way (tool) to find memory leaks ? -
Setting ffmpeg properly in ubuntu 16.04
22 août 2017, par pro neonI am following this website for ffmpeg tutorial : http://dranger.com
I tried to compile the programs after setting up ffmpeg in ubuntu by looking on some online videos but none of them worked. Some times GCC gives me undefined reference error and sometimes header not found error. I looked on some of the answers on SO that said that we need to do some change in the code as the new api is not backwards compatible but still GCC gives me undefined reference error.
Here is the code that I am trying to compile :// tutorial01.c
// Code based on a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de)
// Tested on Gentoo, CVS version 5/01/07 compiled with GCC 4.1.1
// With updates from https://github.com/chelyaev/ffmpeg-tutorial
// Updates tested on:
// LAVC 54.59.100, LAVF 54.29.104, LSWS 2.1.101
// on GCC 4.7.2 in Debian February 2015
// A small sample program that shows how to use libavformat and libavcodec to
// read video from a file.
//
// Use
//
// gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
//
// to build (assuming libavformat and libavcodec are correctly installed
// your system).
//
// Run using
//
// tutorial01 myvideofile.mpg
//
// to write the first five frames from "myvideofile.mpg" to disk in PPM
// format.
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libswscale></libswscale>swscale.h>
#include
// compatibility with newer API
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame
#endif
void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
FILE *pFile;
char szFilename[32];
int y;
// Open file
sprintf(szFilename, "frame%d.ppm", iFrame);
pFile=fopen(szFilename, "wb");
if(pFile==NULL)
return;
// Write header
fprintf(pFile, "P6\n%d %d\n255\n", width, height);
// Write pixel data
for(y=0; ydata[0]+y*pFrame->linesize[0], 1, width*3, pFile);
// Close file
fclose(pFile);
}
int main(int argc, char *argv[]) {
// Initalizing these to NULL prevents segfaults!
AVFormatContext *pFormatCtx = NULL;
int i, videoStream;
AVCodecContext *pCodecCtxOrig = NULL;
AVCodecContext *pCodecCtx = NULL;
AVCodec *pCodec = NULL;
AVFrame *pFrame = NULL;
AVFrame *pFrameRGB = NULL;
AVPacket packet;
int frameFinished;
int numBytes;
uint8_t *buffer = NULL;
struct SwsContext *sws_ctx = NULL;
if(argc < 2) {
printf("Please provide a movie file\n");
return -1;
}
// Register all formats and codecs
av_register_all();
// Open video file
if(avformat_open_input(&pFormatCtx, argv[1], NULL, NULL)!=0)
return -1; // Couldn't open file
// Retrieve stream information
if(avformat_find_stream_info(pFormatCtx, NULL)<0)
return -1; // Couldn't find stream information
// Dump information about file onto standard error
av_dump_format(pFormatCtx, 0, argv[1], 0);
// Find the first video stream
videoStream=-1;
for(i=0; inb_streams; i++)
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
videoStream=i;
break;
}
if(videoStream==-1)
return -1; // Didn't find a video stream
// Get a pointer to the codec context for the video stream
pCodecCtxOrig=pFormatCtx->streams[videoStream]->codec;
// Find the decoder for the video stream
pCodec=avcodec_find_decoder(pCodecCtxOrig->codec_id);
if(pCodec==NULL) {
fprintf(stderr, "Unsupported codec!\n");
return -1; // Codec not found
}
// Copy context
pCodecCtx = avcodec_alloc_context3(pCodec);
if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0) {
fprintf(stderr, "Couldn't copy codec context");
return -1; // Error copying codec context
}
// Open codec
if(avcodec_open2(pCodecCtx, pCodec, NULL)<0)
return -1; // Could not open codec
// Allocate video frame
pFrame=av_frame_alloc();
// Allocate an AVFrame structure
pFrameRGB=av_frame_alloc();
if(pFrameRGB==NULL)
return -1;
// Determine required buffer size and allocate buffer
numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
pCodecCtx->height);
buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
// Assign appropriate parts of buffer to image planes in pFrameRGB
// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
// of AVPicture
avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
pCodecCtx->width, pCodecCtx->height);
// initialize SWS context for software scaling
sws_ctx = sws_getContext(pCodecCtx->width,
pCodecCtx->height,
pCodecCtx->pix_fmt,
pCodecCtx->width,
pCodecCtx->height,
PIX_FMT_RGB24,
SWS_BILINEAR,
NULL,
NULL,
NULL
);
// Read frames and save first five frames to disk
i=0;
while(av_read_frame(pFormatCtx, &packet)>=0) {
// Is this a packet from the video stream?
if(packet.stream_index==videoStream) {
// Decode video frame
avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
// Did we get a video frame?
if(frameFinished) {
// Convert the image from its native format to RGB
sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,
pFrame->linesize, 0, pCodecCtx->height,
pFrameRGB->data, pFrameRGB->linesize);
// Save the frame to disk
if(++i<=5)
SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height,
i);
}
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
// Free the RGB image
av_free(buffer);
av_frame_free(&pFrameRGB);
// Free the YUV frame
av_frame_free(&pFrame);
// Close the codecs
avcodec_close(pCodecCtx);
avcodec_close(pCodecCtxOrig);
// Close the video file
avformat_close_input(&pFormatCtx);
return 0;
}This is the command I use to compile :
gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
-
How do I properly enable ffmpeg for matplotlib.animation ?
9 novembre 2018, par spanishgumI have covered a lot of ground on stack so far trying to get ffmpeg going so I can make a timelapse video.
I am on a CentOS 7 machine, running
python3.7.0a0
.python3
>>> import numpy as np
>>> np.__version__
'1.12.0'
>>> import matplotlib as mpl
>>> mpl.__version__
'2.0.0'
>>> import mpl_toolkits.basemap as base
>>> base.__version__
'1.0.7'I found this github gist on installing ffmpeg. I used the chromium source, and installed without a
prefix
option (using the default).I have confirmed that ffmpeg is installed, although I don’t know anything about testing whether it works.
which ffmpeg
/usr/local/bin/ffmpeg
ffmpeg -version
ffmpeg version N-83533-gada281d Copyright (c) 2000-2017 the FFmpeg dev elopers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11
configuration:
libavutil 55. 47.100 / 55. 47.100
libavcodec 57. 80.100 / 57. 80.100
libavformat 57. 66.102 / 57. 66.102
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 73.100 / 6. 73.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100I tried to run a few sample examples I found online :
[1] http://matplotlib.org/examples/animation/basic_example_writer.html
[2] https://stackoverflow.com/a/23098090/3454650
Everything works fine up until I try to save the animation file.
[1]
anim.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])
[2]
im_ani.save('im.mp4', writer=writer)
I found here that explictly setting the path to ffmpeg might be necessary so I added this to the top of the test scripts :
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'
I tried a few more tweaks in the code but always get the same response, which I do not know how to begin deciphering :
Traceback (most recent call last):
File "testanim.py", line 27, in <module>
writer.grab_frame()
File "/usr/local/lib/python3.7/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 256, in saving
self.finish()
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 276, in finish
self.cleanup()
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 311, in cleanup
out, err = self._proc.communicate()
File "/usr/local/lib/python3.7/subprocess.py", line 836, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/local/lib/python3.7/subprocess.py", line 1474, in _communicate
selector.register(self.stdout, selectors.EVENT_READ)
File "/usr/local/lib/python3.7/selectors.py", line 351, in register
key = super().register(fileobj, events, data)
File "/usr/local/lib/python3.7/selectors.py", line 237, in register
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
File "/usr/local/lib/python3.7/selectors.py", line 224, in _fileobj_lookup
return _fileobj_to_fd(fileobj)
File "/usr/local/lib/python3.7/selectors.py", line 39, in _fileobj_to_fd
"{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=6>
</module>Is there something with my configuration that is malformed ? I searched google for this error for some time but never found anything relevant to animations / ffmpeg. Any help would be greatly appreciated.
UPDATE :
@LordNeckBeard pointed me here : https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
I ran into problems with installing the x264 encoding dependency. Some files in libavcodec/*.c (in the
make
output) were reporting undefined references to several functions. After a wild goose chase found this : https://mailman.videolan.org/pipermail/x264-devel/2015-February/010971.htmlTo fix the x264 installation, I simply added some
configure
flags :./configure --enable-static --enable-shared --extra-ldflags="-lswresample -llzma"
UPDATE :
So everything installed fine after fixing the libx264 problems. I went ahead and copied the ffmpeg binary from the
ffmpeg_build
folder into/usr/local/bin/ffmpeg
.After running the script I was getting problems where ffmpeg could not find the libx264 shared object. I think I will have to recompile everything using different prefixes. My intuition tells me there are old files laying around after I have messed with everything, using some configuration that is broken.
So I decided maybe I should just try to use NUX : http://linoxide.com/linux-how-to/install-ffmpeg-centos-7/
I installed ffmpeg using the new rpm, but to no avail. I still was not able to run ffmpeg because of a missing shared object.Finally, instead of usiong files copied into my
/usr/local/bin
folder, I ran ffmpeg directly from the build bin directory. Turns out that this does work properly !So in essence, if I want to install ffmpeg system wide, I need to manually compile from sources again but using a nonlocal prefix.