
Recherche avancée
Médias (29)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (106)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
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 (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (13399)
-
FFMPEG libav gdigrab capturing with wrong colors
7 mars 2018, par user1496491I’m capturing screen with code below, and it gets me the picture with wrong colors.
The picture on left is raw data which I assumed in ARGB the picture in right is encoded as YUV. I’ve tried different formats, the pictures slighly changing, but it’s never looks ow it should be. In what format gdigrab gives its output ? What’s the right way to encode it ?
#include "MainWindow.h"
#include <qguiapplication>
#include <qlabel>
#include <qscreen>
#include <qtimer>
#include <qlayout>
#include <qimage>
#include <qtconcurrent></qtconcurrent>QtConcurrent>
#include <qthreadpool>
#include "ScreenCapture.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
resize(800, 600);
label = new QLabel();
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
auto layout = new QHBoxLayout();
layout->addWidget(label);
auto widget = new QWidget();
widget->setLayout(layout);
setCentralWidget(widget);
init();
initOutFile();
collectFrame();
}
MainWindow::~MainWindow()
{
avformat_close_input(&inputFormatContext);
avformat_free_context(inputFormatContext);
QThreadPool::globalInstance()->waitForDone();
}
void MainWindow::init()
{
av_register_all();
avcodec_register_all();
avdevice_register_all();
auto screen = QGuiApplication::screens()[1];
QRect geometry = screen->geometry();
inputFormatContext = avformat_alloc_context();
AVDictionary* options = NULL;
av_dict_set(&options, "framerate", "30", NULL);
av_dict_set(&options, "offset_x", QString::number(geometry.x()).toLatin1().data(), NULL);
av_dict_set(&options, "offset_y", QString::number(geometry.y()).toLatin1().data(), NULL);
av_dict_set(&options, "preset", "ultrafast", NULL);
av_dict_set(&options, "probesize", "10MB", NULL);
av_dict_set(&options, "pix_fmt", "yuv420p", NULL);
av_dict_set(&options, "video_size", QString(QString::number(geometry.width()) + "x" + QString::number(geometry.height())).toLatin1().data(), NULL);
AVInputFormat* inputFormat = av_find_input_format("gdigrab");
avformat_open_input(&inputFormatContext, "desktop", inputFormat, &options);
// AVDictionary* options = NULL;
// av_dict_set(&options, "framerate", "30", NULL);
// av_dict_set(&options, "preset", "ultrafast", NULL);
// av_dict_set(&options, "vcodec", "h264", NULL);
// av_dict_set(&options, "s", "1280x720", NULL);
// av_dict_set(&options, "crf", "0", NULL);
// av_dict_set(&options, "rtbufsize", "100M", NULL);
// AVInputFormat *format = av_find_input_format("dshow");
// avformat_open_input(&inputFormatContext, "video=screen-capture-recorder", format, &options);
av_dict_free(&options);
avformat_find_stream_info(inputFormatContext, NULL);
videoStreamIndex = av_find_best_stream(inputFormatContext, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
inputCodec = avcodec_find_decoder(inputFormatContext->streams[videoStreamIndex]->codecpar->codec_id);
if(!inputCodec) qDebug() << "Не найден кодек входящего потока!";
inputCodecContext = avcodec_alloc_context3(inputCodec);
inputCodecContext->codec_id = inputCodec->id;
avcodec_parameters_to_context(inputCodecContext, inputFormatContext->streams[videoStreamIndex]->codecpar);
if(avcodec_open2(inputCodecContext, inputCodec, NULL)) qDebug() << "Не удалось открыть входной кодек!";
}
void MainWindow::initOutFile()
{
const char* filename = "C:/Temp/output.mp4";
if(avformat_alloc_output_context2(&outFormatContext, NULL, NULL, filename) < 0) qDebug() << "Не удалось создать выходной контекст!";
outCodec = avcodec_find_encoder(AV_CODEC_ID_MPEG4);
if(!outCodec) qDebug() << "Не удалось найти кодек!";
videoStream = avformat_new_stream(outFormatContext, outCodec);
videoStream->time_base = {1, 30};
const AVPixelFormat* pixelFormat = outCodec->pix_fmts;
while (*pixelFormat != AV_PIX_FMT_NONE)
{
qDebug() << "OUT_FORMAT" << av_get_pix_fmt_name(*pixelFormat);
++pixelFormat;
}
outCodecContext = videoStream->codec;
outCodecContext->bit_rate = 400000;
outCodecContext->width = inputCodecContext->width;
outCodecContext->height = inputCodecContext->height;
outCodecContext->time_base = videoStream->time_base;
outCodecContext->gop_size = 10;
outCodecContext->max_b_frames = 1;
outCodecContext->pix_fmt = AV_PIX_FMT_YUV420P;
if (outFormatContext->oformat->flags & AVFMT_GLOBALHEADER) outCodecContext->flags |= CODEC_FLAG_GLOBAL_HEADER;
if(avcodec_open2(outCodecContext, outCodec, NULL)) qDebug() << "Не удалось открыть выходной кодек!";
swsContext = sws_getContext(inputCodecContext->width,
inputCodecContext->height,
// inputCodecContext->pix_fmt,
AV_PIX_FMT_ABGR,
outCodecContext->width,
outCodecContext->height,
outCodecContext->pix_fmt,
SWS_BICUBIC, NULL, NULL, NULL);
if(avio_open(&outFormatContext->pb, filename, AVIO_FLAG_WRITE) < 0) qDebug() << "Не удалось открыть файл!";
if(avformat_write_header(outFormatContext, NULL) < 0) qDebug() << "Не удалось записать заголовок!";
}
void MainWindow::collectFrame()
{
AVFrame* inFrame = av_frame_alloc();
inFrame->format = inputCodecContext->pix_fmt;
inFrame->width = inputCodecContext->width;
inFrame->height = inputCodecContext->height;
int size = av_image_alloc(inFrame->data, inFrame->linesize, inFrame->width, inFrame->height, inputCodecContext->pix_fmt, 1);
qDebug() << size;
AVFrame* outFrame = av_frame_alloc();
outFrame->format = outCodecContext->pix_fmt;
outFrame->width = outCodecContext->width;
outFrame->height = outCodecContext->height;
qDebug() << av_image_alloc(outFrame->data, outFrame->linesize, outFrame->width, outFrame->height, outCodecContext->pix_fmt, 1);
AVPacket packet;
av_init_packet(&packet);
av_read_frame(inputFormatContext, &packet);
// while(av_read_frame(inputFormatContext, &packet) >= 0)
// {
if(packet.stream_index == videoStream->index)
{
memcpy(inFrame->data[0], packet.data, size);
sws_scale(swsContext, inFrame->data, inFrame->linesize, 0, inputCodecContext->height, outFrame->data, outFrame->linesize);
QImage image(inFrame->data[0], inFrame->width, inFrame->height, QImage::Format_ARGB32);
label->setPixmap(QPixmap::fromImage(image).scaled(label->size(), Qt::KeepAspectRatio));
AVPacket outPacket;
av_init_packet(&outPacket);
int encodeResult = avcodec_receive_packet(outCodecContext, &outPacket);
while(encodeResult == AVERROR(EAGAIN))
{
if(avcodec_send_frame(outCodecContext, outFrame)) qDebug() << "Ошибка отправки фрейма на кодирование!";
encodeResult = avcodec_receive_packet(outCodecContext, &outPacket);
}
if(encodeResult != 0) qDebug() << "Ошибка во время кодирования!" << encodeResult;
if(outPacket.pts != AV_NOPTS_VALUE) outPacket.pts = av_rescale_q(outPacket.pts, videoStream->codec->time_base, videoStream->time_base);
if(outPacket.dts != AV_NOPTS_VALUE) outPacket.dts = av_rescale_q(outPacket.dts, videoStream->codec->time_base, videoStream->time_base);
av_write_frame(outFormatContext, &outPacket);
av_packet_unref(&outPacket);
}
// }
av_packet_unref(&packet);
av_write_trailer(outFormatContext);
avio_close(outFormatContext->pb);
}
</qthreadpool></qimage></qlayout></qtimer></qscreen></qlabel></qguiapplication> -
FFMPEG transcoding.c example produces wrong video frame rate [on hold]
24 juillet 2018, par PoldonI am attempting to get this
transcoding.c
example to work :I had to fix some initialization issues, but the remaining issue I have so far is that the resulting video frame rate is 1/2 of what it should be in the output file. Here is the relevant part of the code :
/* read all packets */
while (1) {
if ((ret = av_read_frame(ifmt_ctx, &packet)) < 0)
break;
stream_index = packet.stream_index;
type = ifmt_ctx->streams[packet.stream_index]->codecpar->codec_type;
av_log(NULL, AV_LOG_DEBUG, "Demuxer gave frame of stream_index %u\n",
stream_index);
if (filter_ctx[stream_index].filter_graph) {
av_log(NULL, AV_LOG_DEBUG, "Going to reencode&filter the frame\n");
frame = av_frame_alloc();
if (!frame) {
ret = AVERROR(ENOMEM);
break;
}
av_packet_rescale_ts(&packet, ifmt_ctx->streams[stream_index]->time_base,
stream_ctx[stream_index].dec_ctx->time_base);
dec_func = (type == AVMEDIA_TYPE_VIDEO) ? avcodec_decode_video2
: avcodec_decode_audio4;
ret = dec_func(stream_ctx[stream_index].dec_ctx, frame, &got_frame,
&packet);
if (ret < 0) {
av_frame_free(&frame);
av_log(NULL, AV_LOG_ERROR, "Decoding failed\n");
break;
}
if (got_frame) {
frame->pts = frame->best_effort_timestamp;
ret = filter_encode_write_frame(frame, stream_index);
av_frame_free(&frame);
if (ret < 0)
goto end;
} else {
av_frame_free(&frame);
}
} else {
/* remux this frame without reencoding */
av_packet_rescale_ts(&packet, ifmt_ctx->streams[stream_index]->time_base,
ofmt_ctx->streams[stream_index]->time_base);
ret = av_interleaved_write_frame(ofmt_ctx, &packet);
if (ret < 0)
goto end;
}
av_packet_unref(&packet);
}I’m using the libraries from ffmpeg 3.4.2 (which is from Ubuntu 18.04). I appreciate any help someone could offer.
-
make : *** No rule to make target 'jni/../third_party/lame/libmp3lame/VbrTag.c', needed by 'obj/local/arm64-v8a/objs/lame/VbrTag.o'. Stop
29 mars 2020, par Pradeep Simba