
Recherche avancée
Autres articles (30)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...) -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)
Sur d’autres sites (4227)
-
ffmpeg failed to call avcodec_send_packet
23 juin 2017, par GizakWindows 10 x64,
ffmpeg : 3.1, prebuilt dllsAbsolute beginner here.
I was trying out a very basic case to decode frames from a video file but desperately failed at every attempts. The final code snippet looks like this :
#define __STDC_CONSTANT_MACROS
extern "C" {
#include<libavutil></libavutil>avutil.h>
#include<libavutil></libavutil>imgutils.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libswscale></libswscale>swscale.h>
}
#include <iostream>
int main(int argc, char **argv) {
AVFormatContext* ctx_format = nullptr;
AVCodecContext* ctx_codec = nullptr;
AVCodec* codec = nullptr;
AVFrame* frame = av_frame_alloc();
int stream_idx;
SwsContext* ctx_sws = nullptr;
const char* fin = argv[1];
AVStream *vid_stream = nullptr;
AVPacket* pkt = av_packet_alloc();
av_register_all();
if (int ret = avformat_open_input(&ctx_format, fin, nullptr, nullptr) != 0) {
std::cout << 1 << std::endl;
return ret;
}
if (avformat_find_stream_info(ctx_format, nullptr) < 0) {
std::cout << 2 << std::endl;
return -1; // Couldn't find stream information
}
av_dump_format(ctx_format, 0, fin, false);
for (int i = 0; i < ctx_format->nb_streams; i++)
if (ctx_format->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
stream_idx = i;
vid_stream = ctx_format->streams[i];
break;
}
if (vid_stream == nullptr) {
std::cout << 4 << std::endl;
return -1;
}
codec = avcodec_find_decoder(vid_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
ctx_codec = avcodec_alloc_context3(codec);
if(avcodec_parameters_to_context(ctx_codec, vid_stream->codecpar)<0)
std::cout << 512;
if (avcodec_open2(ctx_codec, codec, nullptr)<0) {
std::cout << 5;
return -1;
}
//av_new_packet(pkt, pic_size);
while(av_read_frame(ctx_format, pkt) >= 0){
int ret = avcodec_send_packet(ctx_codec, pkt);
if (ret < 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
std::cout << "avcodec_send_packet: " << ret << std::endl;
break;
}
if (pkt->stream_index == stream_idx) {
while (ret >= 0) {
ret = avcodec_receive_frame(ctx_codec, frame);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
//std::cout << "avcodec_receive_frame: " << ret << std::endl;
break;
}
std::cout << "frame: " << ctx_codec->frame_number << std::endl;
}
}
av_packet_unref(pkt);
}
avformat_close_input(&ctx_format);
av_packet_unref(pkt);
avcodec_free_context(&ctx_codec);
avformat_free_context(ctx_format);
return 0;
}
</iostream>It basically leaves everything by its defaults and try to read packets and decode frames from them. The
avcodec_send_packet
always returned a negative value at the first or second round of calling in the while loop.Output for flv :
> .\streamer_test.exe .\SampleVideo_360x240_5mb.flv
Input #0, flv, from '.\SampleVideo_360x240_5mb.flv':
Metadata:
encoder : Lavf53.24.2
Duration: 00:00:53.32, start: 0.000000, bitrate: 787 kb/s
Stream #0:0: Audio: aac (LC), 48000 Hz, 5.1, fltp, 384 kb/s
Stream #0:1: Video: flv1, yuv420p, 320x240, 500 kb/s, 1k fps, 25 tbr, 1k tbn
frame: 1
[flv @ 000001545edb66c0] Bad picture start code
[flv @ 000001545edb66c0] header damaged
avcodec_send_packet: -1094995529Output for mp4 :
> .\streamer_test.exe .\SampleVideo_360x240_10mb.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\SampleVideo_360x240_10mb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01T00:00:00.000000Z
encoder : Lavf53.24.2
Duration: 00:02:05.95, start: 0.000000, bitrate: 669 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 282 kb/s, 15 fps, 15 t
br, 15360 tbn, 30 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : SoundHandler
[h264 @ 000002e2446a6cc0] Invalid NAL unit size (17191968 > 1007).
[h264 @ 000002e2446a6cc0] Error splitting the input into NAL units.
avcodec_send_packet: -1094995529Output for mkv :
> .\streamer_test.exe .\SampleVideo_1280x720_2mb.mkv
Input #0, matroska,webm, from '.\SampleVideo_1280x720_2mb.mkv':
Metadata:
ENCODER : Lavf53.24.2
Duration: 00:00:10.65, bitrate: 1575 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 25 tbc (de
fault)
Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
frame: 1
[mpeg4 @ 000001166798ede0] header damaged
avcodec_send_packet: -1So I guess there must be something wrong around
avcodec_send_packet
call but could not figured out what is missing. Any ideas about the causes ? Much appreciate your help ! -
Could not find codec parameters for stream 0
14 avril 2017, par khinesterWhen I run this command :
ffmpeg -y -i ./in.mp4 -c:v png -f image2pipe -thread_queue_size 1024 -r 25 -t 186.75 -i - -filter_complex overlay=0:0 -c:v libx264 -pix_fmt yuv420p -movflags +faststart ./out.mp4 < ./out.png
I get an error :
(git)-[master]
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './in.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.99.1
Duration: 00:03:06.75, start: 0.000000, bitrate: 538 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x320 [SAR 1:1 DAR 3:2], 465 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 67 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
[image2pipe @ 0x15f7200] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
pipe:: could not find codec parameters
Input #1, image2pipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, none(pc), 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x15e2620] Unable to parse option value "0x0" as image size
[buffer @ 0x15e2620] Unable to parse option value "-1" as pixel format
[buffer @ 0x15e2620] Unable to parse option value "0x0" as image size
[buffer @ 0x15e2620] Error setting option video_size to value 0x0.
[graph 0 input from stream 1:0 @ 0x15e23e0] Error applying options to the filter.
Error configuring complex filters.
Invalid argument
Consider increasing the value for the 'analyzeduration' and 'probesize' options pipe:0: could not find codec parametersWhat am I missing in my setup ?
-
Add watermark to video using ffmpeg in php not working
13 juillet 2017, par RemyaI need to watermark a mp4 video , Currently i am using this code, but it is not working , please solve this
<?php $msg = exec('/usr/local/bin/ffmpeg -i uploads/videos/profile/movie.mp4 -vf "movie=logo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" uploads/videos/profile/output.mp4 2>&1', $output); var_dump($output);?>
The error shows
array (size=27) 0 => string 'FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers' (length=72) 1 => string ' built on Jan 14 2016 22:33:21 with gcc 4.4.7 20120313 (Red Hat 4.4.7-16)' (length=74) 2 => string ' configuration: --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared --enable-libx264 --enable-libtheora --enable-libfaac --enable-avfilter --enable-gpl --enable-nonfree --enable-x11grab --enable-libxvid' (length=220) 3 => string ' libavutil 50.36. 0 / 50.36. 0' (length=35) 4 => string ' libavcore 0.16. 1 / 0.16. 1' (length=35) 5 => string ' libavcodec 52.108. 0 / 52.108. 0' (length=37) 6 => string ' libavformat 52.93. 0 / 52.93. 0' (length=35) 7 => string ' libavdevice 52. 2. 3 / 52. 2. 3' (length=35) 8 => string ' libavfilter 1.74. 0 / 1.74. 0' (length=35) 9 => string ' libswscale 0.12. 0 / 0.12. 0' (length=35) 10 => string 'Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'uploads/videos/profile/movie.mp4':' (length=75) 11 => string ' Metadata:' (length=11) 12 => string ' major_brand : isom' (length=26) 13 => string ' minor_version : 512' (length=25) 14 => string ' compatible_brands: isomiso2avc1mp41' (length=39) 15 => string ' creation_time : 1970-01-01 00:00:00' (length=41) 16 => tring ' encoder : Lavf53.24.2' (length=33) 17 => string ' Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s' (length=60) 18 => string ' Stream #0.0(und): Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc' (length=117) 19 => string ' Metadata:' (length=13) 20 => string ' creation_time : 1970-01-01 00:00:00' (length=43) 21 => string ' Stream #0.1(und): Audio: aac, 48000 Hz, 5.1, s16, 384 kb/s' (length=62) 22 => string ' Metadata:' (length=13) 23 => string ' creation_time : 1970-01-01 00:00:00' (length=43) 24 => string '[buffer @ 0x1e95f70] w:1280 h:720 pixfmt:yuv420p' (length=48) 25 => string 'No such filter: 'movie'' (length=23) 26 => string 'Error opening filters!' (length=22)