
Recherche avancée
Médias (1)
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
Autres articles (111)
-
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (7666)
-
Anomalie #4560 : Améliorer l’accessibilité de la page de login
19 février 2021, par cedric -Ah mince j’avais raté la PR https://git.spip.net/spip/spip/pulls/67 et aussi le role=’alert’ sur les messages d’erreur de chaque champ.
Pour ce dernier point je propose donc https://git.spip.net/spip/spip/pulls/126 -
Java FFmpeg decoding AVPacket result of avcodec_decode_video2 negative
19 octobre 2017, par nh_I’m new to ffmpeg. I’m using FFmpegFrameGrabber and JavaCPP (version 1.3.3) to grab packets of an mp4-video-file. I would like to save the packet’s bytestream in a database in order to decode the packets at the time the data is requested and to process the image.
public static void saveVideoToDB(String pathToVideo){
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(pathToVideo);
grabber.start();
AVPacket pkt;
while ((pkt = grabber.grabPacket()) != null) {
BytePointer data = pkt.data();
data.capacity(pkt.size());
byte[] arr = data.getStringBytes();
//arr = [0, 0, 0, 62, 39, 100, 0, 40, -83, -124.....]
if (pkt.stream_index() == AVMEDIA_TYPE_VIDEO) {
//ToDo: save arr to database
testDecode(arr);
}
}
grabber.close();
logger.info("Import video finished.");
}In my code I first tried to decode a packet’s data for a proof-of-concept, but I’m not sure if it’s working like this :
public static void testDecode(byte[] data){
AVCodec avCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
AVCodecContext avCodecContext = avcodec_alloc_context3(avCodec);
AVDictionary opts = new AVDictionary();
avcodec_open2(avCodecContext, avCodec, opts);
av_dict_free(opts);
AVFrame avFrame = av_frame_alloc();
AVPacket avPacket = new AVPacket();
av_init_packet(avPacket);
Frame frame = new Frame();
avPacket.pts(AV_NOPTS_VALUE);
avPacket.dts(AV_NOPTS_VALUE);
BytePointer bp = new BytePointer(data);
bp.capacity(data.length);
avPacket.data(bp);
avPacket.size(data.length);
avPacket.pos(-1);
IntBuffer gotPicture = IntBuffer.allocate(1);
boolean doVideo = true;
boolean keyFrames = false;
boolean processImage = true;
AVPacket pkt = avPacket;
if (doVideo) {
int len = avcodec_decode_video2(avCodecContext, avFrame, gotPicture, avPacket);
if (len >= 0 && gotPicture.get(0) != 0
&& (!keyFrames || avFrame.pict_type() == AV_PICTURE_TYPE_I)) {
//ToDo: process image
logger.info("decode success");
}else{
logger.info("decode failed");
}
}
}The result of avcodec_decode_video2 is always negative (-1094995529 => Invalid data found when processing input) and I receive following errors :
[h264 @ 00000000214d11a0] No start code is found.
[h264 @ 00000000214d11a0] Error splitting the input into NAL units.
Here are some metadata from the input :
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\user01\Documents\fullstream.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomiso2
creation_time : 2017-07-27T11:17:19.000000Z
Duration: 00:55:55.48, start: 0.000000, bitrate: 5126 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 4996 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc (default)
Metadata:
creation_time : 2017-07-27T11:17:19.000000Z
handler_name : VideoHandler
Stream #0:1(eng): Audio: mp3 (mp4a / 0x6134706D), 24000 Hz, mono, s16p, 125 kb/s (default)
Metadata:
creation_time : 2017-07-27T11:17:19.000000Z
handler_name : SoundHandler -
FFmpeg - negative value returned from avcodec_receive_frame when open another video
24 avril 2019, par JinxI’ve been trying to extract frames from a video then convert them to images saved on the disk. My code always works perfectly for the first video opened, which means if I open another video or the same video again something happen will happen. I’m sure that I’ve cleared and closed format context and codec context.
When I opened a new video,
avcodec_receive_frame()
returned -11 andavio_open()
returned -2. What’s more, it does’t point out whyavcodec_receive_frame()
returns a negative value and so isavio_open()
.avcodec_receive_frame()
other negative values : legitimate decoding errors
avio_open()
@return >= 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure
ImageExtractor.cpp
clear and close everything
void ImageExtractor::unload()
{
QMutexLocker LOCKER(&mutex);
if (!format_ctx)
return;
avformat_flush(format_ctx);
if (!format_ctx)
return;
avformat_close_input(&format_ctx);
if (!codec_ctx)
return;
avcodec_flush_buffers(codec_ctx);
avcodec_free_context(&codec_ctx);
avcodec_close(codec_ctx);
av_free(codec_ctx);
loaded = false;
}open format context
void ImageExtractor::load()
{
unload();
QMutexLocker LOCKER(&mutex);
int ret;
format_ctx = avformat_alloc_context();
ret = avformat_open_input(&format_ctx, source.toLocal8Bit(), nullptr, nullptr);
// some other code here
codec_par = avcodec_parameters_alloc();
avcodec_parameters_copy(codec_par, format_ctx->streams[vsi]->codecpar);
}open codec context
bool ImageExtractor::openCodec()
{
if (!codec_par)
return false;
QMutexLocker LOCKER(&mutex);
AVCodec* codec = avcodec_find_decoder(codec_par->codec_id);
if (!codec) {
unload();
// some other code
}
codec_ctx = avcodec_alloc_context3(codec);
avcodec_parameters_to_context(codec_ctx, codec_par);
avcodec_parameters_free(&codec_par);
int ret = avcodec_open2(codec_ctx, codec, 0);
if (ret != 0) {
unload();
// some other code
}
return true;
}decode
void ImageExtractor::decode()
{
if (!format_ctx || !codec_ctx)
return;
QMutexLocker LOCKER(&mutex);
char buf[1024];
AVPacket* packet = av_packet_alloc();
AVFrame* frame = av_frame_alloc();
int ret;
int count = 1;
while (true) {
ret = av_read_frame(format_ctx, packet);
if (ret == AVERROR_EOF) {
// some other code
}
if (packet->stream_index == vsi) {
ret = avcodec_send_packet(codec_ctx, packet);
if (ret < 0) {
continue;
}
ret = avcodec_receive_frame(codec_ctx, frame);
if (ret == 0) {
snprintf(buf, sizeof(buf), "%s/%d.jpg", destination.toLocal8Bit().data(), count);
saveImage(frame, buf);
}
count++;
}
av_packet_unref(packet);
}
source = "";
destination = "";
unload();
}write images to disk
int ImageExtractor::saveImage(AVFrame *frame, char *destination) {
AVCodecContext *pCodeCtx = NULL;
AVFormatContext *pFormatCtx = avformat_alloc_context();
pFormatCtx->oformat = av_guess_format("mjpeg", NULL, NULL);
int ret = avio_open(&pFormatCtx->pb, destination, AVIO_FLAG_READ_WRITE);
if ( ret < 0) {
unload();
return -1;
}
//some other code
}