
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (25)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
Sur d’autres sites (4283)
-
When using libva* (ffmpeg) encoded GIF images, an error is reported when compiling the demo
10 août 2023, par yangjinhui2936issuse : I need to use the GIF encoding feature in FFMPEG to encode argb images as gifs.Because the encoding effect of using GIF library is not as good as the effect of FFMPEG.
However, several libraries like avcodec were too bulky, so I did some cropping.I just want to keep the functionality of GIF encoding.
Below is my makefile for cropping ffmpeg :


#!/bin/sh
# ./configure --prefix=$(pwd)/output --arch=arm --target-os=linux --enable-cross-compile --disable-asm --cross-prefix=arm-linux-gnueabihf- 
./configure --prefix=$(pwd)/output --target-os=linux --disable-asm \
--disable-gpl --enable-nonfree --enable-error-resilience --enable-debug --enable-shared --enable-small --enable-zlib \
--disable-ffmpeg --disable-ffprobe --disable-ffplay --disable-programs --disable-symver\
 --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-decoder=h264 --enable-avformat \
 --disable-txtpages --enable-avcodec --enable-avutil \
 --disable-avresample --disable-avfilter --disable-avdevice --disable-postproc \
 --disable-swscale --enable-decoder=gif --enable-demuxer=gif --enable-muxer=gif --disable-iconv \
 --disable-v4l2-m2m --disable-indevs --disable-outdevs

make clean
make -j8

make install



Then link the compiled so to the gif demo.
Blew is gif demo code(He was automatically generated by chatgpt, and I want to verify it) :


#include 
// #include "output/include/imgutils.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"

int main() {
 AVCodec *enc_codec;
 AVCodecContext *enc_ctx = NULL;
 AVStream *stream = NULL;
 int ret;

 AVFormatContext *fmt_ctx = avformat_alloc_context();
 if (!fmt_ctx) {
 fprintf(stderr, "Could not allocate format context\n");
 return 1;
 }
 
 AVInputFormat *input_fmt = av_find_input_format("image2");
 if ((ret = avformat_open_input(&fmt_ctx, "input.bmp", input_fmt, NULL)) < 0) {
 fprintf(stderr, "Could not open input file %d\n", ret);
 return ret;
 }

 AVCodec *dec_codec = avcodec_find_decoder(AV_CODEC_ID_BMP);
 if (!dec_codec) {
 fprintf(stderr, "Decoder not found\n");
 return 1;
 }
 
 AVCodecContext *dec_ctx = avcodec_alloc_context3(dec_codec);
 if (!dec_ctx) {
 fprintf(stderr, "Could not allocate decoder context\n");
 return 1;
 }

 if ((ret = avcodec_open2(dec_ctx, dec_codec, NULL)) < 0) {
 fprintf(stderr, "Could not open decoder\n");
 return 1;
 }

 AVOutputFormat *out_fmt = av_guess_format("gif", NULL, NULL);
 if (!out_fmt) {
 fprintf(stderr, "Could not find output format\n");
 return 1;
 }

 AVFormatContext *out_ctx = NULL;
 if ((ret = avformat_alloc_output_context2(&out_ctx, out_fmt, NULL, NULL)) < 0) {
 fprintf(stderr, "Could not allocate output context\n");
 return 1;
 }

 stream = avformat_new_stream(out_ctx, NULL);
 if (!stream) {
 fprintf(stderr, "Could not create new stream\n");
 return 1;
 }

 enc_codec = avcodec_find_encoder(AV_CODEC_ID_GIF);
 if (!enc_codec) {
 fprintf(stderr, "Encoder not found\n");
 return 1;
 }

 enc_ctx = avcodec_alloc_context3(enc_codec);
 if (!enc_ctx) {
 fprintf(stderr, "Could not allocate encoder context\n");
 return 1;
 }

 if ((ret = avcodec_parameters_from_context(stream->codecpar, dec_ctx)) < 0) {
 fprintf(stderr, "Could not copy decoder parameters\n");
 return 1;
 }

 if ((ret = avcodec_open2(enc_ctx, enc_codec, NULL)) < 0) {
 fprintf(stderr, "Could not open encoder\n");
 return 1;
 }
 
 enc_ctx->pix_fmt = AV_PIX_FMT_RGB8; 
 enc_ctx->width = dec_ctx->width; 
 enc_ctx->height = dec_ctx->height; 
 enc_ctx->time_base = (AVRational){1, 25}; 

 avformat_init_output(out_ctx, NULL);

 if (!(out_fmt->flags & AVFMT_NOFILE)) {
 if ((ret = avio_open(&out_ctx->pb, "output.gif", AVIO_FLAG_WRITE)) < 0) {
 fprintf(stderr, "Could not open output file\n");
 return ret;
 }
 }

 avformat_write_header(out_ctx, NULL);

 AVFrame *frame = av_frame_alloc();
 AVPacket pkt;
 int frame_count = 0;

 while (av_read_frame(fmt_ctx, &pkt) >= 0) {
 avcodec_send_packet(dec_ctx, &pkt);
 while (avcodec_receive_frame(dec_ctx, frame) == 0) {
 avcodec_send_frame(enc_ctx, frame);
 while (avcodec_receive_packet(enc_ctx, &pkt) == 0) {
 pkt.stream_index = stream->index;
 av_interleaved_write_frame(out_ctx, &pkt);
 av_packet_unref(&pkt);
 }

 frame_count++;
 printf("Encoded frame %d\n", frame_count);
 }
 av_packet_unref(&pkt);
 }

 av_write_trailer(out_ctx);

 avcodec_close(enc_ctx);
 avcodec_free_context(&enc_ctx);
 avcodec_close(dec_ctx);
 avcodec_free_context(&dec_ctx);
 av_frame_free(&frame);

 avformat_close_input(&fmt_ctx);
 avformat_free_context(fmt_ctx);
 avio_close(out_ctx->pb);
 avformat_free_context(out_ctx);

 return 0;
}




Belw is shell of compile script for gif :


#!/bin/sh
gcc -o x2gif x2gif.c -L ./output/lib/ -l:libavformat.a -l:libavcodec.a -l:libavutil.a -lz -I ./output/include/



Unfortunately, the compilation did not pass.
How can I troubleshoot and resolve this issue ?


./output/lib/libavutil.a(lfg.o): In function `av_bmg_get':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/lfg.c:59: undefined reference to `log'
./output/lib/libavutil.a(hwcontext_cuda.o): In function `cuda_free_functions':
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:175: undefined reference to `dlclose'
./output/lib/libavutil.a(hwcontext_cuda.o): In function `cuda_load_functions':
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:192: undefined reference to `dlopen'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:194: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:195: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:196: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:197: undefined reference to `dlsym'
/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:198: undefined reference to `dlsym'
./output/lib/libavutil.a(hwcontext_cuda.o):/data1/yang/tool/ffmpeg-3.4.4/./compat/cuda/dynlink_loader.h:199: more undefined references to `dlsym' follow
./output/lib/libavutil.a(rational.o): In function `av_d2q':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/rational.c:120: undefined reference to `floor'
./output/lib/libavutil.a(eval.o): In function `eval_expr':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:184: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:185: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:189: undefined reference to `floor'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:190: undefined reference to `ceil'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:191: undefined reference to `trunc'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:192: undefined reference to `round'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:263: undefined reference to `pow'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:300: undefined reference to `floor'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:309: undefined reference to `pow'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:315: undefined reference to `hypot'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:316: undefined reference to `atan2'
./output/lib/libavutil.a(eval.o): In function `ff_exp10':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/ffmath.h:44: undefined reference to `exp2'
./output/lib/libavutil.a(eval.o): In function `parse_primary':
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:417: undefined reference to `sinh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:418: undefined reference to `cosh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:419: undefined reference to `tanh'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:420: undefined reference to `sin'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:421: undefined reference to `cos'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:422: undefined reference to `tan'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:423: undefined reference to `atan'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:424: undefined reference to `asin'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:425: undefined reference to `acos'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:426: undefined reference to `exp'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:427: undefined reference to `log'
/data1/yang/tool/ffmpeg-3.4.4/libavutil/eval.c:428: undefined reference to `fabs'



-
ffmpeg file conversion AWS Lamda
10 avril 2021, par eartoolboxI want a .webm file to be converted to a .wav file after it hits my S3 bucket. I followed this tutorial and tried to adapt it from my use case using the .webm -> .wav ffmpeg command described here.


My AWS Lambda function generally works, in that when my .webm file hits the source bucket, it is converted to .wav and ends up in the destination bucket. However, the resulting file .wav is always 0 bytes (though the .webm not, including the appropriate audio). Did I adapt the code wrong ? I only changed the ffmpeg_cmd line from the first link.


import json
import os
import subprocess
import shlex
import boto3

S3_DESTINATION_BUCKET = "hmtm-out"
SIGNED_URL_TIMEOUT = 60

def lambda_handler(event, context):

 s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
 s3_source_key = event['Records'][0]['s3']['object']['key']

 s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
 s3_destination_filename = s3_source_basename + ".wav"

 s3_client = boto3.client('s3')
 s3_source_signed_url = s3_client.generate_presigned_url('get_object',
 Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
 ExpiresIn=SIGNED_URL_TIMEOUT)
 
 ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_source_signed_url + "\" -c:a pcm_f32le " + s3_destination_filename + " -"
 
 
 command1 = shlex.split(ffmpeg_cmd)
 p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

 resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)

 return {
 'statusCode': 200,
 'body': json.dumps('Processing complete successfully')
 }
 



-
ffmpeg file conversion AWS Lambda
10 avril 2021, par eartoolboxI want a .webm file to be converted to a .wav file after it hits my S3 bucket. I followed this tutorial and tried to adapt it from my use case using the .webm -> .wav ffmpeg command described here.


My AWS Lambda function generally works, in that when my .webm file hits the source bucket, it is converted to .wav and ends up in the destination bucket. However, the resulting file .wav is always 0 bytes (though the .webm not, including the appropriate audio). Did I adapt the code wrong ? I only changed the ffmpeg_cmd line from the first link.


import json
import os
import subprocess
import shlex
import boto3

S3_DESTINATION_BUCKET = "hmtm-out"
SIGNED_URL_TIMEOUT = 60

def lambda_handler(event, context):

 s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
 s3_source_key = event['Records'][0]['s3']['object']['key']

 s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
 s3_destination_filename = s3_source_basename + ".wav"

 s3_client = boto3.client('s3')
 s3_source_signed_url = s3_client.generate_presigned_url('get_object',
 Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
 ExpiresIn=SIGNED_URL_TIMEOUT)
 
 ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_source_signed_url + "\" -c:a pcm_f32le " + s3_destination_filename + " -"
 
 
 command1 = shlex.split(ffmpeg_cmd)
 p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

 resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)

 return {
 'statusCode': 200,
 'body': json.dumps('Processing complete successfully')
 }