
Recherche avancée
Autres articles (18)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
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 (...)
Sur d’autres sites (4489)
-
Want to send a video from desktop to Wowza using ffmpeg
3 mars 2018, par ST94I am trying to stream a local
.mp4
video file from my laptop toWowza Streaming Engine
using ffmpeg. Both systems are able to ping each other. I give the following command on my laptopffmpeg -re -i bunny_1080p_60fps_normal.mp4 -vcodec libx264 -acodec aac -ar 48000 -strict experimental -f flv "rtmp://192.168.1.22:1935/live/myStream"
192.168.1.22
is the IP address of Wowza server residing on another system runningUbuntu 17.04
.I see the following on the command prompt of my laptop when I give the above command,
ffmpeg version N-89894-g18e2ac032e Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 56. 7.100 / 56. 7.100
libavcodec 58. 9.100 / 58. 9.100
libavformat 58. 5.101 / 58. 5.101
libavdevice 58. 0.101 / 58. 0.101
libavfilter 7. 11.101 / 7. 11.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bunny_1080p_60fps_normal.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2013-12-16T17:59:32.000000Z
title : Big Buck Bunny, Sunflower version
artist : Blender Foundation 2008, Janus Bager Kristensen 2013
comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
genre : Animation
composer : Sacha Goedegebure
Duration: 00:10:34.53, start: 0.000000, bitrate: 4486 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 4001 kb/s, 60 fps, 60 tbr, 60k tbn, 120 tbc (default)
Metadata:
creation_time : 2013-12-16T17:59:32.000000Z
handler_name : GPAC ISO Video Handler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 160 kb/s (default)
Metadata:
creation_time : 2013-12-16T17:59:37.000000Z
handler_name : GPAC ISO Audio Handler
Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
Metadata:
creation_time : 2013-12-16T17:59:37.000000Z
handler_name : GPAC ISO Audio Handler
Side data:
audio service type: main
[rtmp @ 000001ed7c4108c0] No credentials set
[rtmp @ 000001ed7c4108c0] Server error: [ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ] :
rtmp://192.168.1.22:1935/live/myStream: Unknown error occurredCan anyone please tell me what the exact procedure is to stream a video file to Wowza .
How will I be able to view the stream at Wowza ?
-
Create an audio file and fill it with the RTP package payload using ffmpeg
24 août 2020, par WithoutExperienceMy task is to extract the payload of an
RTP
packet and save it as an audio file. In my case, I get the payload type - 8 (PCMA). I processRTP
packets and store all the payload in a separate buffer. After that, I have to process this buffer and create an audio file. And that's my problem :(

First, the specification says that in payload 8 (PCMA), audio samples are U8(bitRate / clockRate = 64000 / 8000) in size. But I can't even find a decoder for this sample size. What might be the problem ?


Second, if I create synthetic sound, I can't record it in mka audio format.


As a cheat sheet, I use this link.


Based on this example, I wrote something similar :



class AudioGenerater
{
public:

 enum AudioFormatType
 {
 AudioFormat_WAV,
 AudioFormat_MP3
 };

public:

 AudioGenerater();
 ~AudioGenerater() = default;

 void generateAudioFileWithOptions(
 QString fileName,
 QByteArray pcmData,
 AVCodecID codecID,
 int channel,
 int bitRate,
 int sampleRate,
 AVSampleFormat format);

private:

 // init Format
 bool initFormat(QString audioFileName);

private:

 AVCodec *m_AudioCodec = nullptr;
 AVCodecContext *m_AudioCodecContext = nullptr;
 AVFormatContext *m_FormatContext = nullptr;
 AVOutputFormat *m_OutputFormat = nullptr;
};




Cpp file :


AudioGenerater::AudioGenerater()
{
 av_register_all();
 avcodec_register_all();
}

bool AudioGenerater::initFormat(QString audioFileName)
{
 // Create an output Format context
 int result = avformat_alloc_output_context2(&m_FormatContext, nullptr, nullptr, audioFileName.toLocal8Bit().data());
 if (result < 0) {
 return false;
 }

 m_OutputFormat = m_FormatContext->oformat;

 // Create an audio stream
 AVStream *audioStream = avformat_new_stream(m_FormatContext, m_AudioCodec);
 if (audioStream == nullptr) {
 avformat_free_context(m_FormatContext);
 return false;
 }

 // Set the parameters in the stream
 audioStream->id = m_FormatContext->nb_streams - 1;
 audioStream->time_base = { 1, 64000 };
 result = avcodec_parameters_from_context(audioStream->codecpar, m_AudioCodecContext);
 if (result < 0) {
 avformat_free_context(m_FormatContext);
 return false;
 }

 // Print FormatContext information
 av_dump_format(m_FormatContext, 0, audioFileName.toLocal8Bit().data(), 1);

 // Open file IO
 if (!(m_OutputFormat->flags & AVFMT_NOFILE)) {
 result = avio_open(&m_FormatContext->pb, audioFileName.toLocal8Bit().data(), AVIO_FLAG_WRITE);
 if (result < 0) {
 avformat_free_context(m_FormatContext);
 return false;
 }
 }

 return true;
}

void AudioGenerater::generateAudioFileWithOptions(
 QString _fileName,
 QByteArray _pcmData,
 AVCodecID _codecID,
 int _channel,
 int _bitRate,
 int _sampleRate,
 AVSampleFormat _format)
{
 AVCodecID codecID = _codecID;
 // Find Codec
 m_AudioCodec = avcodec_find_encoder(codecID);
 if (m_AudioCodec == nullptr) {
 return;
 }

 // Create an encoder context
 m_AudioCodecContext = avcodec_alloc_context3(m_AudioCodec);
 if (m_AudioCodecContext == nullptr){
 return;
 }

 // Setting parameters
 m_AudioCodecContext->bit_rate = _bitRate;
 m_AudioCodecContext->sample_rate = _sampleRate;
 m_AudioCodecContext->sample_fmt = _format;
 m_AudioCodecContext->channels = _channel;


 m_AudioCodecContext->channel_layout = av_get_default_channel_layout(_channel);
 m_AudioCodecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

 // Turn on the encoder
 int result = avcodec_open2(m_AudioCodecContext, m_AudioCodec, nullptr);
 if (result < 0) {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }

 // Create a package
 if (!initFormat(_fileName)) {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }

 // write to the file header
 result = avformat_write_header(m_FormatContext, nullptr);
 if (result < 0) {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }

 // Create Frame
 AVFrame *frame = av_frame_alloc();
 if (frame == nullptr) {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }

 int nb_samples = 0;
 if (m_AudioCodecContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) {
 nb_samples = 10000;
 }
 else {
 nb_samples = m_AudioCodecContext->frame_size;
 }

 // Set the parameters of the Frame
 frame->nb_samples = nb_samples;
 frame->format = m_AudioCodecContext->sample_fmt;
 frame->channel_layout = m_AudioCodecContext->channel_layout;

 // Apply for data memory
 result = av_frame_get_buffer(frame, 0);
 if (result < 0)
 {
 av_frame_free(&frame); {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }
 }

 // Set the Frame to be writable
 result = av_frame_make_writable(frame);
 if (result < 0)
 {
 av_frame_free(&frame); {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }
 }

 int perFrameDataSize = frame->linesize[0];
 int count = _pcmData.size() / perFrameDataSize;
 bool needAddOne = false;
 if (_pcmData.size() % perFrameDataSize != 0)
 {
 count++;
 needAddOne = true;
 }

 int frameCount = 0;
 for (int i = 0; i < count; ++i)
 {
 // Create a Packet
 AVPacket *pkt = av_packet_alloc();
 if (pkt == nullptr) {
 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
 return;
 }
 av_init_packet(pkt);

 if (i == count - 1)
 perFrameDataSize = _pcmData.size() % perFrameDataSize;

 // Synthesize WAV files
 memset(frame->data[0], 0, perFrameDataSize);
 memcpy(frame->data[0], &(_pcmData.data()[perFrameDataSize * i]), perFrameDataSize);


 frame->pts = frameCount++;
 // send Frame
 result = avcodec_send_frame(m_AudioCodecContext, frame);
 if (result < 0)
 continue;

 // Receive the encoded Packet
 result = avcodec_receive_packet(m_AudioCodecContext, pkt);
 if (result < 0)
 {
 av_packet_free(&pkt);
 continue;
 }

 // write to file
 av_packet_rescale_ts(pkt, m_AudioCodecContext->time_base, m_FormatContext->streams[0]->time_base);
 pkt->stream_index = 0;
 result = av_interleaved_write_frame(m_FormatContext, pkt);
 if (result < 0)
 continue;

 av_packet_free(&pkt);
 }

 // write to the end of the file
 av_write_trailer(m_FormatContext);
 // Close file IO
 avio_closep(&m_FormatContext->pb);
 // Release Frame memory
 av_frame_free(&frame);

 avcodec_free_context(&m_AudioCodecContext);
 if (m_FormatContext != nullptr)
 avformat_free_context(m_FormatContext);
}



Main :


int main(int argc, char *argv[])
{
 QCoreApplication a(argc, argv);
 AudioGenerater generator;
 
 av_log_set_level(AV_LOG_DEBUG);
 av_log_set_flags(av_log_get_flags());
 
 QFile file("pcma.raw");
 if (!file.open(QIODevice::ReadOnly)) {
 return EXIT_FAILURE;
 }
 QByteArray pcmaData(file.readAll());
 
 generator.generateAudioFileWithOptions(
 "test.mka",
 pcmaData,
 AV_CODEC_ID_PCM_ALAW,
 1, 64000, 8000,
 AV_SAMPLE_FMT_U8);

 return a.exec();
}




After I run the program, here are the errors that come out :


[pcm_alaw @ 0x19229a0] Specified sample format u8 is invalid or not supported



But if I set s16p instead of U8 format :


generator.generateAudioFileWithOptions(
 "test.mka",
 pcmaData,
 AV_CODEC_ID_PCM_ALAW,
 1, 64000, 8000,
 AV_SAMPLE_FMT_S16P);



I get twice as fast audio track, with a lot of noise. I need a sequential instruction encoding raw audio data into an audio file. Unfortunately, I don't understand what my error is.


-
Measuring success for your SEO content
20 mars 2020, par Jake Thornton — Uncategorized