
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (92)
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...) -
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)
Sur d’autres sites (4042)
-
Using ffmpeg to convert sound files for use in an android app
10 janvier 2012, par stefsshort : i'm trying to simply play a sound file converted with ffmpeg in my android app, but happen to have problems getting it to work.
long : we have an iphone app and an android app doing the same thing, and i have to port the feature playing a sound on an user interaction. i have the source file in the
aiff
format, and tried to convert it tomp3
for android. but the app keeps crashing when it tries to load the fileAssetFileDescriptor fileDescriptor = context.getResources().openRawResourceFd(resid);
final MediaPlayer mp = new MediaPlayer();
mp.setDataSource(fileDescriptor.getFileDescriptor(), fileDescriptor.getStartOffset(), fileDescriptor.getLength());
fileDescriptor.close();
mp.prepare();more specifically,
mp.setDataSource
crashes. some digging around led me to believe that something's wrong with the encoding. the sound file itself resides in res/raw.11-29 17:11:48.012: ERROR/SoundManager(15580): java.io.IOException: setDataSourceFD failed.: status=0x80000000
11-29 17:11:48.012: ERROR/SoundManager(15580): at android.media.MediaPlayer.setDataSource(Native Method)
...what i tried :
- using a different mp3 that's already used with the same code in a different place. this works.
- converted it to wav file. this didn't cause the app to crash, but it neither played a sound. that might be a different problem.
- converted it to ogg ; crashed
so, the the
ffmpeg
conversion parameters are as follows :$ ffmpeg -i click_24db.aif -f mp3 ~/foobar/wheel_click.mp3
ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 24 2011 14:31:00 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
configuration: --prefix=/opt/local --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --enable-libxvid --enable-libx264 --enable-libvpx --enable-libspeex --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, aiff, from 'click_24db.aif':
Duration: 00:00:00.01, start: 0.000000, bitrate: 1570 kb/s
Stream #0.0: Audio: pcm_s16be, 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mp3, to '/Users/xyz/foobar/wheel_click.mp3':
Metadata:
TSSE : Lavf52.111.0
Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
size= 1kB time=00:00:00.05 bitrate= 92.9kbits/s
video:0kB audio:0kB global headers:0kB muxing overhead 45.563549%the resulting file plays nice in itunes, does not play in vlc and crashes when loaded with the android.media.MediaPlayer (note : i first tried it with the SoundPool lib, with both mp3 and ogg, but that didn't work either).
i also tried the following paramters, which didn't work :
ffmpeg -i inputfile.aif -f mp3 -acodec libmp3lame -ab 192000 -ar 44100 outputfile.mp3
i'm working on osx, built ffmpeg with macports today, android api level is 7 (google api, 2.1-update1). looking at the "supported formats" table on dev.android didn't indicate my file to be out of the spec, but i may be mistaken in that.
i don't have the slightest clue regarding bitrates and so on, so could anybody please point me to the right combination of ffmpeg parameters to get a working mp3 for android ? i don't care if the resulting file would be mp3, ogg or 3gp or whatever.
-
Invalid data when creating mkv container with h264 stream because extradata is null
18 février 2020, par pixelouI need to encode raw frames into an h264 stream inside an mkv container using ffmpeg’s c api.
All the examples I could find copy existing codec parameters from a decoder so I had to modify it a bit.#include <cstdio>
#include <cstring>
#include <iostream>
extern "C" {
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>avutil.h>
#include <libavutil></libavutil>imgutils.h>
#include <libavutil></libavutil>opt.h>
#include <libswscale></libswscale>swscale.h>
}
static char error_msg[4096] = "";
int main(int argc, char **argv) {
int err;
char *filename = (char *)av_malloc(4096);
AVCodec *codec = nullptr;
SwsContext *color_converter = nullptr;
AVCodecContext *encoder = nullptr;
AVFormatContext *container = nullptr;
AVStream *stream = nullptr;
std::snprintf(filename, sizeof(filename), "%s", "out.mkv");
// Create encoder
codec = avcodec_find_encoder_by_name("libx264");
if (codec == NULL) {
std::cerr << "codec not found" << std::endl;
goto cleanup;
}
encoder = avcodec_alloc_context3(codec);
if (encoder == nullptr) {
std::cerr << "failed to allocate encoder" << std::endl;
goto cleanup;
}
// Configure encoder
encoder->color_range = AVCOL_RANGE_JPEG;
encoder->height = 1024;
encoder->width = 1280;
encoder->sample_aspect_ratio = {1, 1};
encoder->pix_fmt = AV_PIX_FMT_YUVJ420P;
encoder->time_base = {1, 10};
encoder->framerate = {10, 1};
err = av_opt_set_double(encoder->priv_data, "crf", 0.0, 0);
if (err < 0) {
av_make_error_string(error_msg, sizeof(error_msg), err);
std::cerr << "failed to initialize encoder: " << error_msg << std::endl;
goto cleanup;
}
err = avcodec_open2(encoder, codec, nullptr);
if (err < 0) {
av_make_error_string(error_msg, sizeof(error_msg), err);
std::cerr << "failed to initialize encoder: " << error_msg << std::endl;
goto cleanup;
}
// Create container
avformat_alloc_output_context2(&container, NULL, NULL, filename);
if (container == NULL) {
std::cerr << "failed to allocate container" << std::endl;
goto cleanup;
}
// Add stream
stream = avformat_new_stream(container, nullptr);
if (stream == NULL) {
std::cerr << "failed to create new stream" << std::endl;
goto cleanup;
}
stream->time_base = encoder->time_base;
err = avcodec_parameters_from_context(stream->codecpar, encoder);
if (err < 0) {
av_make_error_string(error_msg, sizeof(error_msg), err);
std::cerr << "failed to configure stream: " << error_msg << std::endl;
goto cleanup;
}
// encoder->extradata_size == 0 at this point!
// Open file and write file header
err = avio_open(&container->pb, filename, AVIO_FLAG_WRITE);
if (err < 0) {
av_make_error_string(error_msg, sizeof(error_msg), err);
std::cerr << "failed to open output file: " << error_msg << std::endl;
goto cleanup;
}
err = avformat_write_header(container, nullptr);
// fails in ff_isom_write_avcc because stream->codecpar->extradata is null.
if (err < 0) {
av_make_error_string(error_msg, sizeof(error_msg), err);
std::cerr << "failed to set-up container: " << error_msg << std::endl;
goto cleanup;
}
cleanup:
avcodec_close(encoder);
if (container != nullptr) {
avio_closep(&container->pb);
}
avcodec_free_context(&encoder);
sws_freeContext(color_converter);
avformat_free_context(container);
av_free(filename);
return 0;
}
</iostream></cstring></cstdio>This fails with EINVAL (Invalid data found when processing input) at the avformat_write_header line (more precisely in ff_isom_write_avcc inside the ffmpeg library) because stream->codecpar->extradata is null. The same code works for an mp4 container and I have no clue how to initialize stream->codecpar->extradata (or encoder->extradata) manually.
I have checked similar questions about that problem but could not find a conclusive answer :
- https://stackoverflow.com/a/22231863/5786475 says extradata can be null when h264 is in annex b format
- https://stackoverflow.com/a/27471912/5786475 says it shouldn’t be null.
-
FFMpeg returns error : Unrecognized option 'master_pl_name'
14 février 2021, par jonatasosI used this command (described at the processing message bellow) on my application several times before and always worked well. Now returns that error.


'/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' 
'/home/vagrant/code/myapp/storage/videos/videos_disk/a3.mp4' '-map' '0' '-vcodec' 'libx264' 
'-b:v' '500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_0_500_%05d.ts' '-master_pl_name' 
'master_playlist_guide_0.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_0_500.m3u8' '-map' '0' '-vcodec' 
'libx264' '-b:v' '1500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_1_1500_%05d.ts' '-master_pl_name' 
'master_playlist_guide_1.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_1_1500.m3u8' '-map' '0' '-vcodec' 
'libx264' '-b:v' '3000k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_2_3000_%05d.ts' '-master_pl_name' 
'master_playlist_guide_2.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_2_3000.m3u8'



(single line:) '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' '/home/vagrant/code/myapp/storage/videos/videos_disk/a3.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_0_500_%05d.ts' '-master_pl_name' 'master_playlist_guide_0.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_0_500.m3u8' '-map' '0' '-vcodec' 'libx264' '-b:v' '1500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_1_1500_%05d.ts' '-master_pl_name' 'master_playlist_guide_1.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_1_1500.m3u8' '-map' '0' '-vcodec' 'libx264' '-b:v' '3000k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_2_3000_%05d.ts' '-master_pl_name' 'master_playlist_guide_2.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_2_3000.m3u8':




This is the error returned :


ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
 configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
 libavutil 55. 78.100 / 55. 78.100
 libavcodec 57.107.100 / 57.107.100
 libavformat 57. 83.100 / 57. 83.100
 libavdevice 57. 10.100 / 57. 10.100
 libavfilter 6.107.100 / 6.107.100
 libavresample 3. 7. 0 / 3. 7. 0
 libswscale 4. 8.100 / 4. 8.100
 libswresample 2. 9.100 / 2. 9.100
 libpostproc 54. 7.100 / 54. 7.100
Unrecognized option 'master_pl_name'.
Error splitting the argument list: Option not found



I`ve reinstalled the ffmpeg, also tested in a virtual machine and the same error happens.


Live server : CentOS 7 / Apache2 / PHP-fpm 7.3 ;
Virtual machine : Ubuntu 20.04 / nginx / PHP-fpm 7.4.5


I really have no clue about what to do about it now.