
Recherche avancée
Autres articles (45)
-
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
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. -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (4826)
-
store pcm data into file, but can not play that file
25 mai 2016, par Peng QuI am writing a simple program, which reads mp3 file and store its pcm data into another file. I could get that file now, but when I play that on windows, I failed. So is there any wrong in my code, or windows couldn’t play raw audio data ?
#include
#include
#include <libavutil></libavutil>avutil.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
int main()
{
int err;
FILE *fout = fopen("test.wav", "wb");
av_register_all();
// step 1, open file and find audio stream
AVFormatContext *fmtx = NULL;
err = avformat_open_input(&fmtx, "melodylove.mp3", NULL, NULL);
assert(!err);
err = avformat_find_stream_info(fmtx, NULL);
assert(!err);
int audio_stream_idx = -1;
AVStream *st;
AVCodecContext *decx;
AVCodec *dec;
for (int i = 0; i < fmtx->nb_streams; ++i) {
audio_stream_idx = i;
if (fmtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
st = fmtx->streams[i];
decx = st->codec;
dec = avcodec_find_decoder(decx->codec_id);
decx->request_channel_layout = AV_CH_LAYOUT_STEREO_DOWNMIX;
decx->request_sample_fmt = AV_SAMPLE_FMT_FLT;
avcodec_open2(decx, dec, NULL);
break;
}
}
assert(audio_stream_idx != -1);
int channels = decx->channels;
int sample_rate = decx->sample_rate;
int planar = av_sample_fmt_is_planar(decx->sample_fmt);
int num_planes = planar? decx->channels : 1;
const char *sample_name = av_get_sample_fmt_name(decx->sample_fmt);
printf("sample name: %s, channels: %d, sample rate: %d\n",
sample_name, channels, sample_rate);
printf("is planar: %d, planes: %d\n", planar, num_planes);
/*
* above I print some infomation about mp3 file, they are:
* sample name: s16p, channels: 2, sample rate: 48000
* is planar: 1, planes: 2
*/
getchar();
AVPacket pkt;
av_init_packet(&pkt);
AVFrame *frame = av_frame_alloc();
while (1) {
err = av_read_frame(fmtx, &pkt);
if (err < 0) {
printf("read frame fail\n");
fclose(fout);
exit(-1);
}
if (pkt.stream_index != audio_stream_idx) {
printf("we don't need this stream\n");
continue;
}
printf("data size: %d\n", pkt.size);
int got_frame = 0;
int bytes = avcodec_decode_audio4(decx, frame, &got_frame, &pkt);
if (bytes < 0) {
printf("decode audio fail\n");
continue;
}
printf("frame size: %d, samples: %d\n", bytes, frame->nb_samples);
if (got_frame) {
int input_samples = frame->nb_samples * decx->channels;
int sz = input_samples / num_planes;
short buffer1[input_samples];
for (int j = 0; j < frame->nb_samples; ++j) {
for (int i = 0; i < num_planes; ++i) {
short *d = (short *)frame->data[i];
buffer1[j*2+i] = d[j];
}
}
fwrite(buffer1, input_samples, 2, fout);
} else {
printf("why not get frame???");
}
}
} -
Streaming audio file conversion process
11 janvier 2017, par YALI am integrating IBM Speech to Text API to my Django project. The problem that I have right now is that we allow users to upload audio files and majority of them are in the format of MP3 or MP4. However, the API only takes FLAC or WAV format.
I am currently using FFMPEG for file conversion. However, this audio conversion library loads the entire audio file in memory as opposed to doing it in chunks.
I wonder what would be a good solution to this problem or other packages that I should use ?
-
No such file or directory Error with custom FFMPEG + CarrierWave method
10 juillet 2013, par dodgerogers747I am using AWS CORS to upload videos to my site, all of which works as planned.
I have the following model method which runs as an after_create callback (for speed) to take a screenshot from the video file on AWS. I plan to move this out into a delayed job but I don't think this will solve this particular issue. Please advise if mistaken.
I use FFMPEG to take a screenshot from the AWS self.file location, I then send the file to CarrierWave by saving the file to self.screenshot where it is uploaded to AWS.
Approx. 50% of the time it errors out with
Errno::ENOENT - No such file or directory
for the location of the screenshot image.How can I rectify my code to remove this error and how come it only occurs around 50% of the time ? If anyone needs more code just shout.
video.rb
after_create :take_screenshot
mount_uploader :screenshot, ImageUploader
def take_screenshot
location = "#{Rails.root}/public/uploads/tmp/screenshots/#{unique}_#{File.basename(file)}.jpg"
system `ffmpeg #{log_level} -i #{self.file} -ss 00:00:0#{time_frame} -vframes 1 #{location}`
logger.debug "Trying to take screenshot from #{self.file}"
#pass the actual file to CarrierWave to handle the image upload
self.screenshot = File.open(location)
self.save
logger.debug "Deleting tmp file: #{location}: #{File.delete(location)}" if self.screenshot.present?
end
def unique
(0..6).map{(65+rand(26)).chr}.join
end
def log_level
"-loglevel panic"
end
def time_frame
rand(0..3)
endStack trace :
Started POST "/videos" for 127.0.0.1 at 2013-07-10 03:58:49 +0800
Processing by VideosController#create as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"6M1Ia+Ag2E3HVKH2PO/p7jewxSpMPdWeVHGA933Bzjw=", "video"=>{"file"=>"http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v"}}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 9 LIMIT 1
(0.1ms) BEGIN
SQL (0.2ms) INSERT INTO `videos` (`created_at`, `file`, `question_id`, `screenshot`, `updated_at`, `user_id`) VALUES ('2013-07-09 19:58:49', 'http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v', NULL, NULL, '2013-07-09 19:58:49', 9)
Trying to take screenshot from http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v
(0.8ms) ROLLBACK
Completed 500 Internal Server Error in 3550ms
Errno::ENOENT - No such file or directory - /Users/me/rails/project/public/uploads/tmp/screenshots/WCACLIC_Good_7iron.m4v.jpg:
app/models/video.rb:24:in `initialize'
app/models/video.rb:24:in `open'
app/models/video.rb:24:in `take_screenshot'