
Recherche avancée
Médias (2)
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
Autres articles (69)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (11763)
-
error in hls play video streaming with ffmpeg real time manipulation
4 août 2019, par Mohsen RahnamaeiI am using fluent ffmpeg to write something on video streaming real-time
means that I am using this tool to write text on every ts file which server wants to serve in order to response the hls request from client :
in server iam using this code :res.setHeader('Content-Type', CONTENT_TYPE.SEGMENT)
res.statusCode = 200
var proc = ffmpeg(req.filePath).videoFilters({
filter: 'drawtext',
options: {
text: 'VERY LONG TEXT VERY VERY VERY VERY LOL!!!',
fontsize: 36,
fontcolor: 'white',
x: '(main_w/2-text_w/2)',
y: '(text_h/2)+15',
shadowcolor: 'black',
shadowx: 2,
shadowy: 2
}
}
)
.videoCodec('libx264')
.audioCodec('aac')
.format('mpegts')
.on('end', function (stdout, stderr) {
console.log('Transcoding succeeded !', req.filePath);
})
.on('error', function (err) {
console.log('an error happened: ' + err.message);
}).pipe(res, {
end: true
})but in client just play first ts file and after that, I get this log in the console :
[log] > AVC:6798 ms overlapping between fragments detected
blob:http://demo.jwp…a8dc-56b513684988:1
[log] > Video/PTS/DTS adjusted: 6798/6798,delta:-6798 ms
blob:http://demo.jwp…a8dc-56b513684988:1and a bunch of this log :
[warn] > Dropping 1 audio frame @ 6.805s due to 6797 ms overlap.
what should I do ?????
-
FFmpeg - avcodec_receive_frame returns 0 but frames are invalid
9 juillet 2019, par JinxI’ve been trying to extract images from videos, but not those with PNG codec. My code works fine with those with JPEG.
avcodec_receive_frame
worked successfully but the data of the frames was like trash ? Do I have to do something special to demuxing when dealing with PNG ?Exception thrown at 0x00007FFF7DF34B9A (msvcrt.dll) in Program.exe : 0xC0000005 : Access violation reading location 0x00000000000003F0 when calling
avcodec_send_frame
in mysaveImage
function, which means I was accessing invalid or unalloacted memory I guess. How this happened ?Just suppose all the function calls returned 0 until exception thrown.
Decoding :
bool ImageExtractor::decode() {
// some other code here
ret = avcodec_send_packet(codec_ctx, packet); // returned 0
ret = avcodec_receive_frame(codec_ctx, frame); // returned 0
if (ret == 0) {
if (count >= target_frame) {
snprintf(buf, sizeof(buf), "%s/%d.png", destination.toLocal8Bit().data(), count);
saveImage(frame, buf); // a function that writes images on disk
}
// some other code here
}
bool ImageExtractor::saveImage(AVFrame *frame, char *destination) {
AVFormatContext *imgFmtCtx = avformat_alloc_context();
pFormatCtx->oformat = av_guess_format("mjpeg", NULL, NULL);
// some other code here
if (!frame)
std::cout << "invalid frame \n";
if (!imgCodecCtx) // AV_CODEC_ID_MJPEG(7)
std::cout << "invalid codec ctx \n";
ret = avcodec_send_frame(imgCodecCtx, frame); // everything stopped here
}Demuxing :
avformat_open_input(&format_ctx, source.toLocal8Bit(), nullptr, nullptr);
vsi = av_find_best_stream(format_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);
codec_par = avcodec_parameters_alloc();
avcodec_parameters_copy(codec_par, format_ctx->streams[vsi]->codecpar);
AVCodec* codec = avcodec_find_decoder(codec_par->codec_id); // AV_CODEC_ID_PNG(61)
codec_ctx = avcodec_alloc_context3(codec);
avcodec_parameters_to_context(codec_ctx, codec_par);
avcodec_parameters_free(&codec_par);
avcodec_open2(codec_ctx, codec, 0); -
Using ffmpeg's avcodec_receive_frame() and why do I get these vertical lines in the decodec image sometimes
7 juillet 2019, par Lucas ZanellaI’m using the modern ffmpeg API which instructs me to use
avcodec_send_packet
andavcodec_receive_frame
. There are literally no examples of usage in github so I couldn’t compare with other code.My code kinda works, but sometimes, for less than a second or two, the video gets decoded like this :
I thought it was a buffer size problem, so I increased from
const size_t bufferSize = 408304;
to
const size_t bufferSize = 10408304;
Just to see but the problem persists.
(the video size is 1920x1080 and this happens even when there’s little motion in the screen)
Here’s my decoder class which sends the decoded data to OpenGL in the line
this->frameUpdater->updateData(avFrame->data, avFrame->width, avFrame->height);
void FfmpegDecoder::decodeFrame(uint8_t* frameBuffer, int frameLength)
{
if (frameLength <= 0) return;
int frameFinished = 0;
AVPacket* avPacket = av_packet_alloc();
if (!avPacket) std::cout << "av packet error" << std::endl;
avPacket->size = frameLength;
avPacket->data = frameBuffer;
//Disable ffmpeg annoying output
av_log_set_level(AV_LOG_QUIET);
int sendPacketResult = avcodec_send_packet(avCodecContext, avPacket);
if (!sendPacketResult) {
int receiveFrameResult = avcodec_receive_frame(avCodecContext, avFrame);
if (!receiveFrameResult) {
this->frameUpdater->updateData(avFrame->data, avFrame->width, avFrame->height);
} else if ((receiveFrameResult < 0) && (receiveFrameResult != AVERROR(EAGAIN)) && (receiveFrameResult != AVERROR_EOF)) {
std::cout << "avcodec_receive_frame returned error " << receiveFrameResult /*<< *av_err2str(result).c_str()*/ << std::endl;
} else {
switch (receiveFrameResult) {
//Not exactly an error, we just have to wait for more data
case AVERROR(EAGAIN):
break;
//To be done: what does this error mean? I think it's literally the end of an mp4 file
case AVERROR_EOF:
std::cout << "avcodec_receive_frame AVERROR_EOF" << std::endl;
break;
//To be done: describe what error is this in std cout before stopping
default:
std::cout << "avcodec_receive_frame returned error, stopping..." << receiveFrameResult /*<< av_err2str(result).c_str()*/ << std::endl;
break;
//Error happened, should break anyway
break;
}
}
} else {
switch (sendPacketResult) {
case AVERROR(EAGAIN):
std::cout << "avcodec_send_packet EAGAIN" << std::endl;
break;
case AVERROR_EOF:
std::cout << "avcodec_send_packet AVERROR_EOF" << std::endl;
break;
default:
break;
}
}
}I think that people who knows how decoding works might know instantly why the image gets decoded like this. It’d be very helpful to know why. Thanks !