
Recherche avancée
Autres articles (74)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, 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 (...) -
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
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 (...)
Sur d’autres sites (11192)
-
ffmpeg save 8bit 'raw' pixel data from 10bit source
15 décembre 2023, par memekoSo, I'm extracting
I-Frames
from videos with the intention of converting them to perceptual hashes to be used for analysis

I am specifically working with the raw luma channel data in a Y'CBCR colour-space found in
YUV420p
chroma-subsampled video codecs like h.264 / h.265, which works all well and good, except when the input source uses a10bit
colour-depth.

I was wondering if there is a way to make
ffmpeg
convert and output only the extractedY'
component as raw8bit
pixel data even if the source was originally10bit
, like, is there a raw8bit
output encoder or some kind of filter you can apply ?

That is without having to re-encode the whole video, only potentially doing a conversion on the extracted luma component
I-Frame
data, if it happens to not already be8bit
. I am also usingffmpeg
's scale filter to compress the rawY'
channel data before output, so preferably I would want the10bit
to8bit
conversion to be the last step in the pipeline.

I've already tried specifying an
8bit
pixel format with-pix_fmt yuv420p
, this sort of works, but also causes the output to ignore-filter_complex "extractplanes=y"
and also outputUV
planes, which is not what I want.

-
Anomalie #4357 (Fermé) : page ’contact.html’ différente ?
27 juin 2019, par AnonymeAppliqué par commit r115799.
-
How to save video data in a vector using ffmpeg ? (C++)
25 octobre 2022, par noklaI'm new to ffmpeg and I am trying to write a program for video editing.


I want to import a video file and save it somehow in a vector so I could edit its frames later.
When I saved all the decoded AVFrames in a vector I saw it takes a lot of memory and that I need to find a better way to do so.


The function I used for reading a video :


** the function is in a class that representing video,
source
type isstd::vector<avframe></avframe>


void VideoSource::ReadSource(std::string path)
{
 // Open the file using libavformat
 AVFormatContext* av_format_ctx = avformat_alloc_context();
 if (!av_format_ctx) {
 printf("Couldn't create AVFormatContext\n");
 return; 
 }
 if (avformat_open_input(&av_format_ctx, path.c_str(), NULL, NULL) != 0) {
 printf("Couldn't open video file\n");
 return;
 }

 // Find the first valid video stream inside the file
 int video_stream_index = -1;
 AVCodecParameters* av_codec_params = NULL;
 const AVCodec* av_codec = NULL;
 for (int i = 0; i < av_format_ctx->nb_streams; i)
 {
 av_codec_params = av_format_ctx->streams[i]->codecpar;
 av_codec = avcodec_find_decoder(av_codec_params->codec_id);

 if (!av_codec) {
 continue;
 }
 if (av_codec_params->codec_type == AVMEDIA_TYPE_VIDEO) {
 video_stream_index = i;
 break;
 }
 }

 if (video_stream_index == -1) {
 printf("Couldn't find valid video stream inside file\n");
 return;
 }

 // Set up a codec context for the decoder
 AVCodecContext* av_codec_ctx = avcodec_alloc_context3(av_codec);
 if (!av_codec_ctx) {
 printf("Couldn't create AVCpdecContext\n");
 return;
 }

 if (avcodec_parameters_to_context(av_codec_ctx, av_codec_params) < 0)
 {
 printf("Couldn't initialize AVCodecContext\n");
 return;
 }
 if (avcodec_open2(av_codec_ctx, av_codec, NULL) < 0) {
 printf("Couldn't open codec\n");
 return;
 }

 AVFrame* av_frame = av_frame_alloc();
 if (!av_frame) {
 printf("Couldn't allocate AVFrame\n");
 return;
 }
 AVPacket* av_packet = av_packet_alloc();
 if (!av_packet) {
 printf("Couldn't allocate AVPacket\n");
 return;
 }
 int response;

 while (av_read_frame(av_format_ctx, av_packet) >= 0) {
 if (av_packet->stream_index != video_stream_index) {
 av_packet_unref(av_packet);
 continue;
 }
 response = avcodec_send_packet(av_codec_ctx, av_packet);
 if (response < 0) {
 printf("Failed to decode packet: %s\n", av_err2str(response));
 return;
 }
 response = avcodec_receive_frame(av_codec_ctx, av_frame);
 if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
 av_packet_unref(av_packet);
 continue;
 }
 else if (response < 0) {
 printf("Failed to decode frame: %s\n", av_err2str(response));
 return;
 }
 av_packet_unref(av_packet);

 av_packet = av_packet_alloc();

 // response = avcodec_send_frame(av_codec_ctx, av_frame);

 source.push_back(*new AVFrame);
 source.back() = *av_frame_clone(av_frame);

 av_frame_unref(av_frame);
 }
 

 avformat_close_input(&av_format_ctx);
 avformat_free_context(av_format_ctx);
 av_frame_free(&av_frame);
 av_packet_free(&av_packet);
 avcodec_free_context(&av_codec_ctx);
}



I thought maybe I should save it as a vector of encoded AVFrames or as a vector of encoded packet that contains some frames in it.


When I tried to encode a single AVFrame, I added this line

response = avcodec_send_frame(av_codec_ctx, av_frame);
before pushing the frame into the vector (You can see it marked as a comment in the code above).

It returned invalid argument (-22) and I am not sure why.

Questions :


- 

- Why did I get that error (-22) ?
- How to save an encoded packet with multiple AVFrame in it ?
- Is there a better way of working on a video that won't take as much memory ?