
Recherche avancée
Autres articles (101)
-
Qualité du média après traitement
21 juin 2013, parLe bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...) -
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 (...) -
Prérequis à l’installation
31 janvier 2010, parPréambule
Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
Il (...)
Sur d’autres sites (7115)
-
how do i create a stereo mp3 file with latest version of ffmpeg ?
17 juin 2016, par SeanI’m updating my code from the older version of ffmpeg (53) to the newer (54/55). Code that did work has now been deprecated or removed so i’m having problems updating it.
Previously I could create a stereo MP3 file using a sample format called :
SAMPLE_FMT_S16
That matched up perfectly with my source stream. This has now been replace with
AV_SAMPLE_FMT_S16
Which works fine for mono recordings but when I try to create a stereo MP3 file it bugs out at avcodec_open2 with :
"Specified sample_fmt is not supported."
Through trial and error I’ve found that using
AV_SAMPLE_FMT_S16P
...is accepted by avcodec_open2 but when I get through and create the MP3 file the sound is very distorted - it sounds about 2 octaves lower than usual with a massive hum in the background - here’s an example recording :
http://hosting.ispyconnect.com/example.mp3
I’ve been told by the ffmpeg guys that this is because I now need to manually deinterleave my byte stream before calling :
avcodec_fill_audio_frame
How do I do that ? I’ve tried using the swrescale library without success and i’ve tried manually feeding in L/R data into avcodec_fill_audio_frame but the results i’m getting are sounding exactly the same as without interleaving.
Here is my code for encoding :
void add_audio_sample( AudioWriterPrivateData^ data, BYTE* soundBuffer, int soundBufferSize)
{
libffmpeg::AVCodecContext* c = data->AudioStream->codec;
memcpy(data->AudioBuffer + data->AudioBufferSizeCurrent, soundBuffer, soundBufferSize);
data->AudioBufferSizeCurrent += soundBufferSize;
uint8_t* pSoundBuffer = (uint8_t *)data->AudioBuffer;
DWORD nCurrentSize = data->AudioBufferSizeCurrent;
libffmpeg::AVFrame *frame;
int got_packet;
int ret;
int size = libffmpeg::av_samples_get_buffer_size(NULL, c->channels,
data->AudioInputSampleSize,
c->sample_fmt, 1);
while( nCurrentSize >= size) {
frame=libffmpeg::avcodec_alloc_frame();
libffmpeg::avcodec_get_frame_defaults(frame);
frame->nb_samples = data->AudioInputSampleSize;
ret = libffmpeg::avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, pSoundBuffer, size, 1);
if (ret<0)
{
throw gcnew System::IO::IOException("error filling audio");
}
//audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
libffmpeg::AVPacket pkt = { 0 };
libffmpeg::av_init_packet(&pkt);
ret = libffmpeg::avcodec_encode_audio2(c, &pkt, frame, &got_packet);
if (ret<0)
throw gcnew System::IO::IOException("error encoding audio");
if (got_packet) {
pkt.stream_index = data->AudioStream->index;
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts = libffmpeg::av_rescale_q(pkt.pts, c->time_base, c->time_base);
if (pkt.duration > 0)
pkt.duration = av_rescale_q(pkt.duration, c->time_base, c->time_base);
pkt.flags |= AV_PKT_FLAG_KEY;
if (libffmpeg::av_interleaved_write_frame(data->FormatContext, &pkt) != 0)
throw gcnew System::IO::IOException("unable to write audio frame.");
}
nCurrentSize -= size;
pSoundBuffer += size;
}
memcpy(data->AudioBuffer, data->AudioBuffer + data->AudioBufferSizeCurrent - nCurrentSize, nCurrentSize);
data->AudioBufferSizeCurrent = nCurrentSize;
}Would love to hear any ideas - I’ve been trying to get this working for 3 days now :(
-
JavaCV FFMpegRecorder streams video not displayed properly
20 août 2015, par Mo AdelI have been in loop for 5 days trying to implement JavaCV with FFmpegRecorder, Having figured out that i have to use OpenCvFrameConverter to conert IplImage to frame, I finally managed to see some video over the stream. but now the problem seems to be that the audio works perfect and clearly, but video is not displayed properly.
Beside that there is a massive delay on the stream, well over 40sec, when i thought RTMP had 2-4sec delay,
Here is some code :
FFmpegFrameRecorder Initialization
recorder = new FFmpegFrameRecorder(ffmpeg_link, screenWidth, screenHeight, 1);
recorder.setFormat("flv");
recorder.setSampleRate(44100);
recorder.setAudioCodec(avcodec.AV_CODEC_ID_AAC);
recorder.setVideoCodec(avcodec.AV_CODEC_ID_FLV1);// AV_CODEC_ID_FLV1
recorder.setVideoOption("preset", "ultrafast");
recorder.setFrameRate(30);And here is my SurfaceChanged and PreviewFrame Methods
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Camera.Parameters camParams = mCamera.getParameters();
List sizes = camParams.getSupportedPreviewSizes();
android.hardware.Camera.Size z = getOptimalPreviewSize(sizes, screenWidth, screenHeight);
int imageWidth = z.width;
int imageHeight = z.height;
camParams.setPreviewSize(imageWidth, imageHeight);
mCamera.setParameters(camParams);
for(int[] arr : camParams.getSupportedPreviewFpsRange()){
Log.e(LOG_TAG, "Supported range: " + arr[0] + " - " + arr[1]);
}
Camera.Parameters framerateAttempts = mCamera.getParameters();
camParams.setPreviewFrameRate(frameRate);
Log.v(LOG_TAG,"Preview Framerate: " + camParams.getPreviewFrameRate());
Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
if(display.getRotation() == Surface.ROTATION_0)
{
mCamera.setDisplayOrientation(90);
}
if(display.getRotation() == Surface.ROTATION_90)
{
}
if(display.getRotation() == Surface.ROTATION_180)
{
}
if(display.getRotation() == Surface.ROTATION_270)
{
mCamera.setDisplayOrientation(180);
}
camParams.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
mCamera.setParameters(framerateAttempts);
startPreview();
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
/* get video data */
if (yuvIplimage != null && recording) {
yuvIplimage.getByteBuffer().put(data);
Log.v(LOG_TAG,"Writing Frame");
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
OpenCVFrameConverter.ToIplImage converterToMat = new OpenCVFrameConverter.ToIplImage();
Frame f = converterToMat.convert(yuvIplimage);
recorder.record(f);
} catch (FFmpegFrameRecorder.Exception e) {
Log.v(LOG_TAG,e.getMessage());
e.printStackTrace();
}
}
} -
Merge three media files (Video and image) into one
8 avril 2019, par Munshi Arif RashidI have total three separated media files. The first file is 1600X900 .mp4 file which will be placed at the left side of the screen (Height size will be full screen and width will cover two-thirds of the screen). The second file is 640X480 .png file which will be placed at the upper right of the screen (Height size will be half of the screen and width will cover one-third of the screen). The third file is 640X480 .webm file which will be placed at the lower right of the screen (Height size will be half of screen and width will cover one-thirds of the screen). I want to merge these three files in a single screen as mentioned above. Can anyone help me ? Thanks