
Recherche avancée
Autres articles (30)
-
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users. -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...) -
MediaSPIP Player : les contrôles
26 mai 2010, parLes contrôles à la souris du lecteur
En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)
Sur d’autres sites (5806)
-
ffmpeg - dump_format() function print out 00:00:00
16 juin 2013, par Juneyoung OhI am working with ffmpeg.
The only function that I needed is just extract duration of video on memory, not console.
to do this, I realized that I have to redesign dump_format() function
witch defined in avformat.h.
below is the original source and especially what I need is dump_format
that located in line 3063.
http://ffmpeg.org/doxygen/0.6/libavformat_2utils_8c-source.html#l03063
when I use dump_format, it returns everything fine but except duration.
duration always returns 00:00:00.
below is my test code. When I call line 31 is fine, but not 32.
I want know what is wrong with my code.
I suspect the fact that I dropped function dump_metadata.
But everytime I use that function console prints undefined function error.
1 #include <libavcodec></libavcodec>avcodec.h>
2 #include <libavformat></libavformat>avformat.h>
3 #include
4 #include
5 #include
6
7 void dump_format1(AVFormatContext* ic, int index, const char* url, int is_output);
8
9 int main(int argc, char *argv[]) {
10 AVFormatContext* pFormatCtx;
11 int secs;
12 //need those for printing...
13
14 if(argc < 2) {
15 printf("Please provide a movie file\n");
16 return -1;
17 }
18 //threat Exception for arguements.
19
20 av_register_all();
21 //register all codecs
22
23 //========== Check Context
24 if(av_open_input_file(&pFormatCtx, argv[1], NULL, 0, NULL) != 0)
25 return -1;
26
27 if(av_find_stream_info(pFormatCtx) < 0)
28 return -1;
29
30 //========== Print Basic Information
31 //dump_format(pFormatCtx, 0 , argv[1], 0);
32 dump_format1(pFormatCtx, 0 , argv[1], 0);
33
34
35 if(pFormatCtx->duration != AV_NOPTS_VALUE){
36 secs = (pFormatCtx->duration) / AV_TIME_BASE;
37 }
38
39 /*
40 AV_TIME_BASE = 1000000
41 */
42
43 printf("%d\n",secs);
44
45 return 0;
46 }
47
48 void dump_format1(AVFormatContext *ic,
49 int index,
50 const char *url,
51 int is_output) {
52
53 int i;
54 uint8_t *printed = av_mallocz(ic->nb_streams);
55 if (ic->nb_streams && !printed)
56 return;
57
58 av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
59 is_output ? "Output" : "Input",
60 index,
61 is_output ? ic->oformat->name : ic->iformat->name,
62 is_output ? "to" : "from", url);
63
64 dump_metadata(NULL, ic->metadata, " ");
65
66 //if (!is_output) {
67 av_log(NULL, AV_LOG_INFO, " Duration: ");
68
69
70
71
72 int hours, mins, secs, us;
73 secs = ic->duration / AV_TIME_BASE;
74 us = ic->duration % AV_TIME_BASE;
75 mins = secs / 60;
76 secs %= 60;
77 hours = mins / 60;
78 mins %= 60;
79 av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
80 (100 * us) / AV_TIME_BASE);
81 return;
82 }I compile with following commands.
gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
./tutorial01 /home/juneyoungoh/Videos/CON1234ID.tsThanks for your guidences in advance.
-
FFMpeg\Exception\RuntimeException Encoding failed - Laravel 4 PHP-FFMPEG
10 avril 2014, par WoogygunI'm using PHP-FFMPEG and the latest version of FFPMEG this is the same for my localhost and production server. Im encoding a .wav file(1.5 meg 44.1khz) to .mp3 128k bit rate.
On localhost it runs without issues but, on the production server it gives the following error.
FFMpeg \ Exception \ RuntimeException
Encoding failedMy binaries are located in the public folder right now for dev purposes.
My code is as follows :
Route::get('/audio', function() {
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'ffmpeg',
'ffprobe.binaries' => 'ffprobe',
'timeout' => 3600]);
$audio = $ffmpeg->open(public_path('track.wav'));
$format = new FFMpeg\Format\Audio\Mp3();
$format->on('progress', function ($audio, $format, $percentage) {
echo "$percentage % transcoded";
});
$format-> setAudioKiloBitrate(128);
$audio->save($format, 'track.mp3');}) ;
I can also confirm that FFMPEG is running via shell access :
myuser@mydomain.com [~/public_html/hidden/public]# ffmpeg -i track.wav file.mp3
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --
mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -
pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-
libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --
enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-
swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[wav @ 0x8434b0]max_analyze_duration reached
[wav @ 0x8434b0]Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from 'track.wav':
Duration: 00:00:08.98, bitrate: 1411 kb/s
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mp3, to 'file.mp3':
Metadata:
TSSE : Lavf52.64.2
Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 70kB time=9.01 bitrate= 64.0kbits/s
video:0kB audio:70kB global headers:0kB muxing overhead 0.045772% -
libx264 Input picture width (640) is greater than stride (0)
16 août 2021, par GiuTorI'm trying to encode a series of Cairo surfaces by using libav. Here I initialize AV stuff :


AVStream* video_stream;
 AVCodec* vcodec;
 gint ret;
 
 /* Setup video container */
 avformat_alloc_output_context2(&img->video_format_context, NULL, NULL, filename);
 if (img->video_format_context == NULL)
 {
 img_message(img, TRUE, _("Failed to find a suitable container for %s\n"),filename);
 return FALSE;
 }
 ret = avio_open(&img->video_format_context->pb, filename, AVIO_FLAG_WRITE);
 if (ret < 0)
 {
 img_message(img, TRUE, _("Couldn't write output file %s\n"),filename);
 return FALSE;
 }
 /* Setup video codec */
 vcodec = avcodec_find_encoder(codec_id);
 if (!vcodec)
 {
 img_message(img, TRUE, _("Couldn't find any encoder for %s\n"),filename);
 return FALSE;
 }
 /* Create video stream */
 video_stream = avformat_new_stream(img->video_format_context, vcodec);
 video_stream->id = 0;
 if (! video_stream)
 {
 img_message(img, TRUE, _("Couldn't not allocate video stream\n"));
 return FALSE;
 }
 /* Allocate video encoding context */
 img->codec_context = avcodec_alloc_context3(vcodec);
 if (! img->codec_context)
 {
 img_message(img, TRUE, _("Couldn't allocate video enconding context\n"));
 return FALSE;
 }
 /* Setup video enconding context parameters */
 img->codec_context->codec_id = codec_id;
 img->codec_context->codec_type = AVMEDIA_TYPE_VIDEO;
 img->codec_context->width = img->video_size[0];
 img->codec_context->height = img->video_size[1];
 img->codec_context->sample_aspect_ratio = (struct AVRational) {1, 1};
 img->codec_context->pix_fmt = vcodec->pix_fmts[0];
 img->codec_context->framerate = av_d2q(frame_rate, INT_MAX);

 if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_VP9 || codec_id == AV_CODEC_ID_THEORA || codec_id == AV_CODEC_ID_FLV1 ||
 AV_CODEC_ID_MPEG1VIDEO || codec_id == AV_CODEC_ID_MPEG2VIDEO)
 img->codec_context->bit_rate = round(bitrate_crf * 1000000);

 img->codec_context->time_base = av_inv_q(img->codec_context->framerate);
 video_stream->time_base = img->codec_context->time_base;

 if (img->video_format_context->oformat->flags & AVFMT_GLOBALHEADER)
 img->codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

 /* Some codecs require the CRF value */
 if (codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_H265)
 {
 gchar *crf = g_strdup_printf("%i", bitrate_crf);
 av_opt_set(img->codec_context->priv_data, "crf", crf, AV_OPT_SEARCH_CHILDREN);
 g_free(crf);
 }
 /* Set exporting stage to be multithreaded */
 AVDictionary* opts = NULL;
 av_dict_set(&opts, "threads", "auto", 0);

 /* Open video encoder */
 ret = avcodec_open2(img->codec_context, vcodec, &opts);
 if (ret < 0)
 {
 img_message(img, TRUE, _("Failed to open the video encoder\n"));
 return FALSE;
 }
 /* Copy video encoder parameters to output stream */
 ret = avcodec_parameters_from_context(video_stream->codecpar, img->codec_context);
 if (ret < 0)
 {
 img_message(img, TRUE, _("Failed to copy video encoder parameters to output stream\n"));
 return FALSE;
 }
 
 /* AVFRAME stuff */
 img->video_frame = av_frame_alloc();
 img->video_frame->format = AV_PIX_FMT_RGBA;
 img->video_frame->width = img->video_size[0];
 img->video_frame->height = img->video_size[1];

 av_frame_make_writable(img->video_frame);
 
 ret = av_frame_get_buffer(img->video_frame, 1);
 if (ret < 0)
 img_message(img,TRUE, _("Could not allocate the video frame data\n"));
 img->video_packet = av_packet_alloc();



And here I called repeatedly (the function is called somewehere else) av_send_frame() but it throws the error in the subject :


gint width, height, stride, row, col, offset;
 uint8_t *pix;

 /* Image info and pixel data */
 width = cairo_image_surface_get_width( surface );
 height = cairo_image_surface_get_height( surface );
 stride = cairo_image_surface_get_stride( surface );
 pix = cairo_image_surface_get_data( surface );

 for( row = 0; row < height; row++ )
 {
 for( col = 0; col < width; col++ )
 {
 offset = 3 * col + row * img->video_frame->linesize[0];
 img->video_frame->data[0][offset + 0] = pix[0];
 img->video_frame->data[0][offset + 1] = pix[1];
 img->video_frame->data[0][offset + 2] = pix[2];
 }
 }
 img_export_encode_av_frame(img->video_frame, img->video_format_context, img->codec_context, img->video_packet);
 return TRUE;
}

void img_export_encode_av_frame(AVFrame *frame, AVFormatContext *fmt, AVCodecContext *ctx, AVPacket *pkt)
{
 gint ret;
 
 /* send the frame to the encoder */
 ret = avcodec_send_frame(ctx, frame);
 if (ret < 0)
 g_print("Error sending a frame for encoding\n");

 while (ret >= 0)
 {
 ret = avcodec_receive_packet(ctx, pkt);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 return;
 else if (ret < 0)
 g_print("Error during encoding\n");
 
 av_interleaved_write_frame(fmt, pkt);
 av_packet_unref(pkt);
 }
}



I googled here also but with no luck. It seems I'm the only one to encode a cairo surface. Grepping the error message in ffmpeg sources didn't help. How do I set the stride ? I read ffmpeg does it for me once I allocate the buffer for the frame but in my case it seems it doesn't. Where am I wrong ?