
Recherche avancée
Autres articles (49)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
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 -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (10901)
-
How can I encode a video to play on a DLink DSM-520 using FFMPEG ?
4 octobre 2015, par tolsen64I have been searching, testing, and coming up with nothing for over a week. I want to use FFMPEG to convert mp4’s and mkv’s to AVI files that will play on my DLink DSM-520. Mencoder will do it. The files that FFMPEG generates cause the player to lock up less than a minute into the video. First, here’s what I use to encode the file using Mencoder (scraped from the test.bat file that PocketDIVXEncoder generates :
mencoder.exe ftwd105.mp4 -af volnorm -srate 44100 -oac mp3lame -lameopts mode=0:cbr:br=128 -noodml -vf pp=ac,scale=720:404,crop=720:400,harddup -sws 9 -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:last_pred=2:vstrict=1:threads=2:vmax_b_frames=0:vbitrate=1200 -ffourcc XVID -o ftwd105_HDTV.avi
The output file plays perfectly on the DSM-520. Looking at the file using FFPROBE, I see this :
Input #0, avi, from 'ftwd105_HDTV.avi':
Metadata:
encoder : MEncoder Redxii-SVN-r37527-4.9.3 (x86_64)
Duration: 00:44:32.96, start: 0.000000, bitrate: 1193 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1053 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/sSo now I try the same thing with FFMPEG.
ffmpeg -i ftwd105.mp4 -vcodec mpeg4 -vtag XVID -b:v 1200k -s 720x400 -acodec libmp3lame -ab 128k -ar 44100 -ac 2 -f avi ftwd105_ffmpeg.avi
This file does not play on the media player. It plays choppy with only clicking for sound for about 15-30 seconds, then it freezes. Looking at it with FFPROBE, it looks exactly the same as the one created by Mencoder.
Input #0, avi, from 'ftwd105_ffmpeg.avi':
Metadata:
encoder : Lavf57.0.100
Duration: 00:44:33.14, start: 0.000000, bitrate: 1305 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1165 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/sSo now I encode the video using Xvid4PSP. It plays perfectly fine and FFPROBE shows this :
Input #0, avi, from 'ftwd105_ps2.avi':
Metadata:
encoder : VirtualDubMod 1.5.10.3 | www.virtualdub-fr.org || (build 2550/release)
Duration: 00:44:33.09, start: 0.000000, bitrate: 861 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 723 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/sIt’s using Advanced Simple Profile so I look this up and change my FFMPEG options :
ffmpeg -i ftwd105.mp4 -vcodec mpeg4 -vtag XVID -b:v 1200k -s 720x400 -profile:v 15 -level 0 -acodec libmp3lame -ab 128k -ar 44100 -ac 2 -f avi ftwd105_ffmpeg.avi
But though the output file looks the same using FFPROBE as the one made by Xvid4PSP, it still doesn’t play on the DSM-520.
Input #0, avi, from 'ftwd105_ffmpeg_asp.avi':
Metadata:
encoder : Lavf57.0.100
Duration: 00:44:33.14, start: 0.000000, bitrate: 1305 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1165 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/sSo now i’m at a loss. Is FFMPEG incapable of generating a file that the DSM-520 can play ? The reason I want to use FFMPEG over Mencoder is that it’s much faster. What takes FFMPEG 15 minutes takes Mencoder 40.
I should note that all the files created by FFMPEG play fine on the PC and on my Visio television. The DSM-520 is hooked up to a bedroom tv that isn’t a smart tv.
Edit : I also tried libxvid in place of mpeg4 with the same results.
-
How can I encode a video to play on a DLink DSM-520 using FFMPEG ?
17 octobre 2020, par tolsen64I have been searching, testing, and coming up with nothing for over a week. I want to use FFMPEG to convert mp4's and mkv's to AVI files that will play on my DLink DSM-520. Mencoder will do it. The files that FFMPEG generates cause the player to lock up less than a minute into the video. First, here's what I use to encode the file using Mencoder (scraped from the test.bat file that PocketDIVXEncoder generates :



mencoder.exe ftwd105.mp4 -af volnorm -srate 44100 -oac mp3lame -lameopts mode=0:cbr:br=128 -noodml -vf pp=ac,scale=720:404,crop=720:400,harddup -sws 9 -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:last_pred=2:vstrict=1:threads=2:vmax_b_frames=0:vbitrate=1200 -ffourcc XVID -o ftwd105_HDTV.avi




The output file plays perfectly on the DSM-520. Looking at the file using FFPROBE, I see this :



Input #0, avi, from 'ftwd105_HDTV.avi':
 Metadata:
 encoder : MEncoder Redxii-SVN-r37527-4.9.3 (x86_64)
 Duration: 00:44:32.96, start: 0.000000, bitrate: 1193 kb/s
 Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1053 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s




So now I try the same thing with FFMPEG.



ffmpeg -i ftwd105.mp4 -vcodec mpeg4 -vtag XVID -b:v 1200k -s 720x400 -acodec libmp3lame -ab 128k -ar 44100 -ac 2 -f avi ftwd105_ffmpeg.avi




This file does not play on the media player. It plays choppy with only clicking for sound for about 15-30 seconds, then it freezes. Looking at it with FFPROBE, it looks exactly the same as the one created by Mencoder.



Input #0, avi, from 'ftwd105_ffmpeg.avi':
 Metadata:
 encoder : Lavf57.0.100
 Duration: 00:44:33.14, start: 0.000000, bitrate: 1305 kb/s
 Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1165 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s




So now I encode the video using Xvid4PSP. It plays perfectly fine and FFPROBE shows this :



Input #0, avi, from 'ftwd105_ps2.avi':
 Metadata:
 encoder : VirtualDubMod 1.5.10.3 | www.virtualdub-fr.org || (build 2550/release)
 Duration: 00:44:33.09, start: 0.000000, bitrate: 861 kb/s
 Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 723 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s




It's using Advanced Simple Profile so I look this up and change my FFMPEG options :



ffmpeg -i ftwd105.mp4 -vcodec mpeg4 -vtag XVID -b:v 1200k -s 720x400 -profile:v 15 -level 0 -acodec libmp3lame -ab 128k -ar 44100 -ac 2 -f avi ftwd105_ffmpeg.avi




But though the output file looks the same using FFPROBE as the one made by Xvid4PSP, it still doesn't play on the DSM-520.



Input #0, avi, from 'ftwd105_ffmpeg_asp.avi':
 Metadata:
 encoder : Lavf57.0.100
 Duration: 00:44:33.14, start: 0.000000, bitrate: 1305 kb/s
 Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x400 [SAR 1:1 DAR 9:5], 1165 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 24k tbc
 Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s




So now i'm at a loss. Is FFMPEG incapable of generating a file that the DSM-520 can play ? The reason I want to use FFMPEG over Mencoder is that it's much faster. What takes FFMPEG 15 minutes takes Mencoder 40.



I should note that all the files created by FFMPEG play fine on the PC and on my Visio television. The DSM-520 is hooked up to a bedroom tv that isn't a smart tv.



Edit : I also tried libxvid in place of mpeg4 with the same results.


-
How to play audio using libao and FFmpeg in C ?
12 mars 2024, par OmegaLol21I am trying to create a simple prototype application that opens a video file and plays its audio. I am using the FFmpeg libraries (libavcodec, libavformat, etc) to open and decode the video, and I am attempting to use libao to play the audio. I tried looking up code examples but a lot of them either don't work or use deprecated functions.


So far, I managed to come up with this :


#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libswresample></libswresample>swresample.h>
#include <ao></ao>ao.h>

int main(int argc, char** argv) {
 AVFormatContext* format_ctx = avformat_alloc_context();
 int audio_stream_index = -1;
 AVCodecContext* codec_ctx = NULL;
 AVCodec* codec = NULL;
 AVPacket packet;
 AVFrame* frame = NULL;
 ao_device* device = NULL;
 ao_sample_format sample_format;
 uint8_t* output_buffer = NULL;
 int output_linesize;

 avformat_open_input(&format_ctx, "test.mp4", NULL, NULL);
 avformat_find_stream_info(format_ctx, NULL);

 for (int i = 0; i < format_ctx->nb_streams; i++) {
 if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 audio_stream_index = i;
 break;
 }
 }

 codec_ctx = avcodec_alloc_context3(NULL);
 avcodec_parameters_to_context(codec_ctx, format_ctx->streams[audio_stream_index]->codecpar);
 codec = avcodec_find_decoder(codec_ctx->codec_id);
 avcodec_open2(codec_ctx, codec, NULL);

 // Initialize libao
 ao_initialize();
 int driver_id = ao_default_driver_id();

 sample_format.bits = 16;
 sample_format.channels = 2;
 sample_format.rate = 44100;
 sample_format.byte_format = AO_FMT_NATIVE;
 sample_format.matrix = 0;
 device = ao_open_live(driver_id, &sample_format, NULL);
 if (!device) {
 fprintf(stderr, "Could not open audio device\n");
 return 1;
 }

 frame = av_frame_alloc();

 while (av_read_frame(format_ctx, &packet) >= 0) {
 if (packet.stream_index == audio_stream_index) {
 int ret = avcodec_send_packet(codec_ctx, &packet);
 if (ret < 0) {
 fprintf(stderr, "Error sending packet for decoding\n");
 break;
 }

 while (ret >= 0) {
 ret = avcodec_receive_frame(codec_ctx, frame);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
 }
 else if (ret < 0) {
 fprintf(stderr, "Error during decoding\n");
 break;
 }

 ao_play(device, (char*)frame->data[0], frame->nb_samples * 2 * frame->channels);
 }
 }
 av_packet_unref(&packet);
 }

 // Clean up
 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_close_input(&format_ctx);
 ao_close(device);
 ao_shutdown();
 av_freep(&output_buffer);

 return 0;
}



This is the closest I have gotten to play audio. It plays audio but there is a lot of static sound in the background. I did try using using
frame->linesize[0]
fornum_bytes
inao_play
but that didn't produce a sound that sounded at all like the video.

Is there something I am doing wrong or missing ?


EDIT : While doing more testing, I managed to find out that the above code sample outputs pure static in the left speaker, however, in the right speaker, it does play the audio, albeit heavily distorted ?