
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (38)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)
Sur d’autres sites (4896)
-
Convert opencv mat frame to ffmpeg AVFrame
1er avril 2015, par YoohooI am currently work on a c++ real-time video transmission project, now I am using opencv to capture the webcam, and I want to convert the opencv Mat to ffmepg AVFrame to do the encoding and write into buffer. At the decoder side, read packet from buffer, using ffmpeg decode, and then convert ffmpeg AVFrame to opencv Mat again and play.
Now I have finished the opencv capturing, and I can encode v4l2 source with ffmpeg, but what I want to do is replace the v4l2 source with opencv Mat. But it get error in follow code (I just show the part of the conversion) :
Mat opencvin; //frame from webcam
cap.read(opencvin);
Mat* opencvframe;
opencvframe = &opencvin;
AVFrame ffmpegout;
Size frameSize = opencvframe->size();
AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
AVFormatContext* outContainer = avformat_alloc_context();
AVStream *outStream = avformat_new_stream(outContainer, encoder);
avcodec_get_context_defaults3(outStream->codec, encoder);
outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
outStream->codec->width = opencvframe->cols;
outStream->codec->height = opencvframe->rows;
avpicture_fill((AVPicture*)&ffmpegout, opencvframe->data, PIX_FMT_BGR24, outStream->codec->width, outStream->codec->height);
ffmpegout.width = frameSize.width;
ffmpegout.height = frameSize.height;This is a code I borrow from Internet, it seems the frame have already be encoded during conversion, before I use
static AVCodecContext *c= NULL;
c = avcodec_alloc_context3(codec);
if (!c) {
fprintf(stderr, "Could not allocate video codec context\n");
exit(1);
}
c->bit_rate = 400000;
/* resolution must be a multiple of two */
c->width = 640;
c->height = 480;
/* frames per second */
c->time_base= (AVRational){1,25};
c->gop_size = 10; /* emit one intra frame every ten frames */
c->max_b_frames=15;
c->pix_fmt = AV_PIX_FMT_YUV420P;
ret = avcodec_encode_video2(c, &pkt, &ffmpegout, &got_output);to encode the frame. And I get core dumped error if I continue encode the converted frame.
I want encode the frame after conversion so that I can keep the data in pkt. How can I get a pure converted ffmpeg frame from opencv frame ?
Or if the encode have already done during coversion, how can I get the output into pkt ?
-
avcodec_open segmentation fault
24 juin 2014, par user3715403Good afternoon,
I got a copy of the ffmpeg’s api-example.c (https://www.ffmpeg.org/doxygen/0.6/api-example_8c-source.html). I tested the function video_encode_example() and got the code working as expected.
I then re-factored this function into different class methods and now I get a seg fault with the call to avcodev_open(). I then changed the code to call the original video_encode_example() from a class method and the calls to avcodec... were successful.
It appears that when called from a function (eg video_encode_example()), the behaviour is as expected, but avcodev_open fails when called from a class method. I traced the code and in both cases the values for the avcodev_open() arguments are assigned (and similar) pointer values. cgdb reports that the seg fault occurs in avcodev_open2()
Any suggestions ?
The code was compiled and tested on a Ubuntu 12.04 64 bit machine) using the libav package available thru apt-get (libavcodec.so.53.35.0)Regards,
DanielAdded comment following the first response :
From the link above, I copied the function video_encode_example() and placed the call inside a class constructor. This part is working.
VideoEncoder::VideoEncoder( const std::string& aFileName)
: mCodec( NULL)
, mCodecContext( NULL)
, picture (NULL)
, mFileName( aFileName)
, mFileHandler( NULL)
{
// must be called before using avcodec lib
::avcodec_init();
// register all the codecs
::avcodec_register_all();
video_encode_example( aFileName.c_str());
return;
...
}The re-factored part includes splitting the avcodev call (from the original video_encode_example() function) to different VideoEncoder methods. The constructor now looks like :
VideoEncoder::VideoEncoder( const std::string& aFileName)
: mCodec( NULL)
, mCodecContext( NULL)
, picture (NULL)
, mFileName( aFileName)
, mFileHandler( NULL)
{
// must be called before using avcodec lib
::avcodec_init();
// register all the codecs
::avcodec_register_all();
// find the mpeg1 video encoder
mCodec = ::avcodec_find_encoder( CODEC_ID_MPEG1VIDEO);
if (!mCodec) {
fprintf( stderr, "codec not found\n");
exit( 1);
}
mCodecContext = ::avcodec_alloc_context3( mCodec);
picture = ::avcodec_alloc_frame();
// put sample parameters
mCodecContext->bit_rate = 400000;
// frames per second
mCodecContext->time_base = (AVRational){1,25};
mCodecContext->gop_size = 10; // emit one intra frame every ten frames
mCodecContext->max_b_frames = 1;
mCodecContext->pix_fmt = PIX_FMT_YUV420P;
// open it
// Initializes the AVCodecContext to use the given AVCodec. Prior to using this function the context has to be allocated.
if (::avcodec_open( mCodecContext, mCodec) < 0) {
fprintf(stderr, "could not open codec\n");
exit( 1);
}
mFileHandler = fopen( mFileName.c_str(), "wb");
if (!mFileHandler) {
fprintf( stderr, "could not open %s\n", mFileName.c_str());
exit( 1);
}
}The call to avcodec_open causes the seg fault. In addition, the fault occurs whether using avcodev_.. or ::avcodev_...
-
FFMPEG HLS stream for Android and IOS
26 février 2015, par PodaI’m trying to stream to mobile devices with ffmpeg and apache2.2 but I haven’t been successful.
I used this command to create the segments and the playlist :
ffmpeg -i http://x.x.x.x:8080 -codec:v libx264 -r 25 -pix_fmt yuv420p -profile:v baseline -level 3 -b:v 500k -s 640x480 -codec:a aac -strict experimental -ac 2 -b:a 128k -movflags faststart -flags -global_header -map 0 -f hls -hls_time 10 -hls_list_size 5 -hls_allow_cache 0 -sc_threshold 0 -hls_flags delete_segments -hls_segment_filename out%05d.ts list.m3u8
The source is a http stream which is streamed by VLC media player.
Example content of the list.m3u8 file :
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:89
#EXTINF:10.000000,
out00089.ts
#EXTINF:10.000000,
out00090.ts
#EXTINF:10.000000,
out00091.ts
#EXTINF:10.000000,
out00092.ts
#EXTINF:9.000000,
out00093.ts
#EXT-X-ENDLISTI created another playlist file - playlist.m3u8 :
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=512000
http://x.x.x.x/list.m3u8If I open this (playlist.m3u8) file in VLC media player then it plays.
It also works in desktop chrome and desktop firefox browsers with Video-js plugin flash fallback.I set the correct MIME types to the .ts and .m3u8 files in .htaccess file :
AddType application/x-mpegURL .m3u8
AddType video/MP2T .tsFFprobe output for playlist.m3u8 :
Input #0, hls,applehttp, from 'playlist.m3u8':
Duration: N/A, start: 1.400000, bitrate: N/A
Program 0
Metadata: variant_bitrate : 512000
Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
Metadata: variant_bitrate : 512000
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 128 kb/s
Metadata: variant_bitrate : 512000What should I do to make it work ?
UPDATE
It works if I provide a link to list.m3u8 file (created by ffmpeg).