
Recherche avancée
Autres articles (53)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, 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 (...) -
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 (7312)
-
WASAPI resampling
30 juin 2013, par magingaxI am trying to play 24bit/48000 Hz audio on PC. my PC seems not support 32bit sample (event GetMixFormat return 32bit/44100Hz device)
So I'm trying to convert 24bit/4800Hz audio into 16bit/44100Hz
but It sound like noise.
sample audio file 'titan.wav' is 24bit/48000Hz s32 format
below is sample code#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
#include
#include <iostream>
#include "Mmdeviceapi.h"
#include "Audioclient.h"
#include "Endpointvolume.h"
using namespace std;
extern "C"
{
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libswscale></libswscale>swscale.h>
#include <libavutil></libavutil>opt.h>
#include <libavutil></libavutil>channel_layout.h>
#include <libavutil></libavutil>samplefmt.h>
#include <libswresample></libswresample>swresample.h>
}
#define MAX_AUDIO_FRAME_SIZE 192000
#define REFTIMES_PER_SEC 10000000 // 1 sec 100ns
#define REFTIMES_PERMILLISEC 10000
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
int alloc_samples_array_and_data(uint8_t*** data, int *linesize, int nb_channels,int nb_samples, enum AVSampleFormat sample_fmt, int align)
{
int nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
*data = (uint8_t**)av_malloc(sizeof(*data) * nb_planes);
return av_samples_alloc(*data, linesize, nb_channels,nb_samples, sample_fmt, align);
}
int main()
{
HRESULT hr;
REFERENCE_TIME buf_duration_request = REFTIMES_PER_SEC;
REFERENCE_TIME buf_duration_actual;
IMMDeviceEnumerator *pEnumerator = NULL;
IMMDevice *pDevice = NULL;
IAudioClient *pAudioClient = NULL;
IAudioRenderClient *pRenderClient = NULL;
IAudioEndpointVolume *endpoint_vol = NULL;
WAVEFORMATEX *fmt = NULL;
UINT32 frame_total = 0; // total frames in buffer
UINT32 frame_avail = 0; // available frame number in buffer
UINT32 frame_fill = 0; // filled frames
BYTE *pData = NULL;
FILE *file_audio = NULL;
BYTE *buf = NULL;
DWORD flags = 0;
CoInitializeEx(NULL,COINIT_MULTITHREADED);
CoCreateInstance (CLSID_MMDeviceEnumerator,NULL,CLSCTX_ALL,IID_IMMDeviceEnumerator, (void**)&pEnumerator);
pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient);
pDevice->Activate(__uuidof(IAudioEndpointVolume),CLSCTX_ALL,NULL,(void**)&endpoint_vol);
pAudioClient->GetMixFormat((WAVEFORMATEX**)&fmt);
fmt->wFormatTag = WAVE_FORMAT_PCM;
fmt->nChannels = 2 ;
fmt->nSamplesPerSec = 44100;
fmt->wBitsPerSample = 16;
fmt->nBlockAlign = fmt->nChannels * (fmt->wBitsPerSample/8);
fmt->nAvgBytesPerSec = fmt->nSamplesPerSec * fmt->nBlockAlign;
fmt->cbSize = 0;
WAVEFORMATEX* closest_format = NULL;
hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, fmt ,&closest_format);
hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, NULL ,buf_duration_request,0, fmt ,NULL);
hr = pAudioClient->GetBufferSize(&frame_total);
hr = pAudioClient->GetService(IID_IAudioRenderClient,(void**)&pRenderClient);
int file_size = 0;
int buf_size = 44100 * 4;
int read_ret = 0;
int read_acc = 0;
fopen_s(&file_audio,"E:\\MOVIE\\titan.wav","rb");
fseek (file_audio , 0 , SEEK_END);
file_size = ftell (file_audio);
rewind (file_audio);
buf = (BYTE*) malloc(buf_size);
pRenderClient->GetBuffer(frame_total,&pData);
read_ret = fread(buf,1,buf_size,file_audio);
read_acc += read_ret;
memcpy(pData,buf,buf_size);
pRenderClient->ReleaseBuffer(frame_total,flags);
buf_duration_actual = (double) REFTIMES_PER_SEC * frame_total / fmt->nSamplesPerSec;
pAudioClient->Start();
//-- resample
uint8_t** src_data;
uint8_t** dst_data;
int src_bufsize = 0;
int dst_bufsize = 0;
int src_linesize = 0;
int dst_linesize = 0;
int src_nb_channels = 0;
int dst_nb_channels = 0;
int src_nb_samples = 1024;
int dst_nb_samples = 0;
int max_dst_nb_samples = 0;
int ret = 0;
SwrContext* swr_ctx = NULL;
swr_ctx = swr_alloc();
av_opt_set_int (swr_ctx,"in_channel_layout" , AV_CH_LAYOUT_MONO, 0);
av_opt_set_int (swr_ctx,"in_sample_rate" , 48000,0);
av_opt_set_sample_fmt (swr_ctx,"in_sample_fmt" , AV_SAMPLE_FMT_S32, 0);
av_opt_set_int (swr_ctx,"out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
av_opt_set_int (swr_ctx,"out_sample_rate" , 44100,0);
av_opt_set_sample_fmt (swr_ctx,"out_sample_fmt" , AV_SAMPLE_FMT_S16, 0);
ret = swr_init(swr_ctx);
src_nb_channels = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_MONO);
src_nb_samples = src_nb_channels * 48000;
dst_nb_samples = av_rescale_rnd(src_nb_samples, 44100,48000,AV_ROUND_UP);
max_dst_nb_samples = dst_nb_samples;
alloc_samples_array_and_data(&src_data,&src_linesize,src_nb_channels,src_nb_samples, AV_SAMPLE_FMT_S32,0);
dst_nb_channels = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
alloc_samples_array_and_data(&dst_data,&dst_linesize,dst_nb_channels,dst_nb_samples, AV_SAMPLE_FMT_S16,0);
//-- end resample
while (read_acc < file_size)
{
Sleep(buf_duration_actual/REFTIMES_PERMILLISEC/2);
pAudioClient->GetCurrentPadding(&frame_fill);
frame_avail = frame_total - frame_fill;
dst_nb_samples = frame_avail;
src_nb_samples = av_rescale_rnd(dst_nb_samples,48000,44100,AV_ROUND_UP);
src_bufsize = av_samples_get_buffer_size(&src_linesize,src_nb_channels,src_nb_samples,AV_SAMPLE_FMT_S32,1);
cout<<"FILLED:"<GetBuffer(frame_avail, &pData );
read_ret = fread(src_data[0],1,src_bufsize,file_audio);
read_acc += read_ret;
ret = swr_convert(swr_ctx,dst_data,dst_nb_samples,(const uint8_t**)src_data,src_nb_samples);
dst_bufsize = av_samples_get_buffer_size(&dst_linesize,dst_nb_channels,ret,AV_SAMPLE_FMT_S16,1);
memcpy(pData, dst_data[0], dst_bufsize);
hr = pRenderClient->ReleaseBuffer(frame_avail,flags);
}
pAudioClient->Stop();
CoTaskMemFree(fmt);
pEnumerator->Release();
pDevice->Release();
pAudioClient->Release();
pRenderClient->Release();
CoUninitialize();
return 0;
}
</iostream> -
FFMPEG 0.6.5 Commands
10 novembre 2015, par j.edgaI need to use
ffmpeg
version0.6.5
for doings things like- transcribing to different formats ;
- changing the quality ;
- taking a still-frame shot ;
- get the total video durations
amongst other things.
I have tried a couple of commands, but they don’t work. How can I do what I want to ?
-
FFmpeg adding 0.05 seconds of silence to transcoded AAC file ?
29 octobre 2015, par FTLRalphIn Java, I’m using FFmpeg to convert a WAV file to AAC with the function :
-i input.wav -ac 1 -ab 64000 -ar 22050 output.aac
When I open these two files in Audacity, I can clearly see that the AAC file is 0.05 seconds longer, with 0.05 seconds of silence added to the beginning.
This is an issue when I try to mux this AAC file with a video file - the audio doesn’t sync up.
Is there some sort of parameter to prevent this behavior or another way to get around this issue ?
Edit - Console output while running the function :
10-28 17:47:10.845: I/System.out(14784): FFmpeg: Running the function: -i "input.wav" -ac 1 -ab 64000 -ar 22050 "output.aac"
10-28 17:47:10.845: I/System.out(14784): FFmpeg function: onStart()
10-28 17:47:10.865: D/FFmpeg(14784): Running publishing updates method
10-28 17:47:10.865: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC)
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): libavutil 54. 7.100 / 54. 7.100
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): libavcodec 56. 1.100 / 56. 1.100
10-28 17:47:10.875: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.875: I/System.out(14784): libavformat 56. 4.101 / 56. 4.101
10-28 17:47:10.880: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.880: I/System.out(14784): libavdevice 56. 0.100 / 56. 0.100
10-28 17:47:10.880: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.880: I/System.out(14784): libavfilter 5. 1.100 / 5. 1.100
10-28 17:47:10.880: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.880: I/System.out(14784): libswscale 3. 0.100 / 3. 0.100
10-28 17:47:10.880: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.880: I/System.out(14784): libswresample 1. 1.100 / 1. 1.100
10-28 17:47:10.880: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.880: I/System.out(14784): libpostproc 53. 0.100 / 53. 0.100
10-28 17:47:10.895: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.895: I/System.out(14784): Guessed Channel Layout for Input Stream #0.0 : mono
10-28 17:47:10.895: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.895: I/System.out(14784): Input #0, wav, from 'input.wav':
10-28 17:47:10.895: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.900: I/System.out(14784): Duration: 00:00:02.50, bitrate: 352 kb/s
10-28 17:47:10.900: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.900: I/System.out(14784): Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, s16, 352 kb/s
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): Output #0, adts, to 'output.aac':
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): Metadata:
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): encoder : Lavf56.4.101
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): Stream #0:0: Audio: aac, 22050 Hz, mono, fltp, 64 kb/s
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): Metadata:
10-28 17:47:10.935: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.935: I/System.out(14784): encoder : Lavc56.1.100 aac
10-28 17:47:10.940: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.940: I/System.out(14784): Stream mapping:
10-28 17:47:10.940: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.940: I/System.out(14784): Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
10-28 17:47:10.940: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:10.940: I/System.out(14784): Press [q] to stop, [?] for help
10-28 17:47:11.395: D/dalvikvm(14784): JIT unchain all for threadid=16
10-28 17:47:11.420: D/dalvikvm(14784): GC_FOR_ALLOC freed 4698K, 40% free 7190K/11964K, paused 271ms, total 272ms
10-28 17:47:11.420: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:11.420: I/System.out(14784): size= 12kB time=00:00:02.50 bitrate= 37.7kbits/s
10-28 17:47:11.455: I/System.out(14784): FFmpeg function: onProgress()...
10-28 17:47:11.455: I/System.out(14784): video:0kB audio:11kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.363914%
10-28 17:47:11.470: I/System.out(14784): FFmpeg function: onSuccess(), message:
10-28 17:47:11.470: I/System.out(14784): ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
10-28 17:47:11.470: I/System.out(14784): built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC)
10-28 17:47:11.470: I/System.out(14784): configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
10-28 17:47:11.470: I/System.out(14784): libavutil 54. 7.100 / 54. 7.100
10-28 17:47:11.470: I/System.out(14784): libavcodec 56. 1.100 / 56. 1.100
10-28 17:47:11.470: I/System.out(14784): libavformat 56. 4.101 / 56. 4.101
10-28 17:47:11.470: I/System.out(14784): libavdevice 56. 0.100 / 56. 0.100
10-28 17:47:11.470: I/System.out(14784): libavfilter 5. 1.100 / 5. 1.100
10-28 17:47:11.470: I/System.out(14784): libswscale 3. 0.100 / 3. 0.100
10-28 17:47:11.470: I/System.out(14784): libswresample 1. 1.100 / 1. 1.100
10-28 17:47:11.470: I/System.out(14784): libpostproc 53. 0.100 / 53. 0.100
10-28 17:47:11.470: I/System.out(14784): Guessed Channel Layout for Input Stream #0.0 : mono
10-28 17:47:11.470: I/System.out(14784): Input #0, wav, from 'input.wav':
10-28 17:47:11.470: I/System.out(14784): Duration: 00:00:02.50, bitrate: 352 kb/s
10-28 17:47:11.475: I/System.out(14784): Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, s16, 352 kb/s
10-28 17:47:11.475: I/System.out(14784): Output #0, adts, to 'output.aac':
10-28 17:47:11.475: I/System.out(14784): Metadata:
10-28 17:47:11.475: I/System.out(14784): encoder : Lavf56.4.101
10-28 17:47:11.475: I/System.out(14784): Stream #0:0: Audio: aac, 22050 Hz, mono, fltp, 64 kb/s
10-28 17:47:11.475: I/System.out(14784): Metadata:
10-28 17:47:11.475: I/System.out(14784): encoder : Lavc56.1.100 aac
10-28 17:47:11.475: I/System.out(14784): Stream mapping:
10-28 17:47:11.475: I/System.out(14784): Stream #0:0 -> #0:0 (pcm_s16le (native) -> aac (native))
10-28 17:47:11.475: I/System.out(14784): Press [q] to stop, [?] for help
10-28 17:47:11.475: I/System.out(14784): size= 12kB time=00:00:02.50 bitrate= 37.7kbits/s
10-28 17:47:11.475: I/System.out(14784): video:0kB audio:11kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.363914%
10-28 17:47:11.475: I/System.out(14784): FFmpeg function: onFinish()