
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (96)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, 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 (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (9132)
-
Convert simple Bash script to PowerShell ?
10 février 2015, par vulcan ravenI have pulled the Bash script from here, which checks the AVI file for bad frames using ffmpeg and cygwin extension. I am able to execute the code in Mingw. I put ffmpeg.exe (ren ffmpeg), cygwin1.dll & cygz.dll in Mingw’s bin dir (/c/mingw/bin/). Now, I am looking to port this bash code to PowerShell. Can anyone shed some PowerShell light on this one ?
Script : (path : /c/mygw/bin/AviConvert)
#!/bin/bash
FFMPEG="ffmpeg"
LIST=`find | grep \.avi$`
for i in $LIST; do
OUTP="$i.txt"
OUTP_OK="$i.txt.ok"
TMP_OUTP="$i.tmp"
if [ -f "$OUTP" -o -f "$OUTP_OK" ] ; then
echo Skipping "$i"
else
echo Checking "$i"...
RESULT="bad"
ffmpeg -v 5 -i "$i" -f null - 2> "$TMP_OUTP" && \
mv "$TMP_OUTP" "$OUTP" && \
RESULT=`grep -v "\(frame\)\|\(Press\)" "$OUTP" | grep "\["`
if [ -z "$RESULT" ] ; then
mv "$OUTP" "$OUTP_OK"
fi
fi
done -
Android ffmpeg - 3gp to mp4(or avi) videos - not playing
18 juillet 2013, par santhoshI am doing an android application which is used to merge two videos and after merge completed play the result video. For this I am using ffmpeg.
When I record two mpeg or mp4 videos, the result merged video playing fine. Now I record the videos as 3gp and convert it into mp4(or avi) and merged it. Then the result video is not playing.
Can anybody help me What may be the problem ?
I am using the following code :
String args[] = {"ffmpeg","-i",""+filename[i]+"",
"-qscale","1",
""+Environment.getExternalStorageDirectory().getPath()+"/Movies/i"+(i + 1)+".mp4(or avi)"};To merge the videos :
String args[] = {"ffmpeg","-i","concat:"+concatPath.toString()+"",
"-vcodec", "copy" ,
"-acodec" ,"copy",
"-vbsf", "aac_adtstoasc",
""+Environment.getExternalStorageDirectory().getPath()+"/Movies/3.mp4"}; -
Problems encoding audio stream for RTMP server using ffmpeg libraries
18 mars, par Filipe JoséI am working on an C++ application that captures audio using miniaudio, and sends the data to a RTMP server running on nginx which will generate an HLS stream to be consumed by a web browser.
I was successful in encoding the data and writing to an .flv file (which I believe to be the container for RTMP), and everything works out fine.


I've also tested the server by running the ffmpeg cli tool directly, and the RTMP server is generating the .m3u8 playlist file as well as the .ts files correctly.


The problem I'm having is that when I change the output on avio_open2() to use the RTMP server url instead of a file name, the HLS files are not being generated, even though I get logging information about a successful connection, and also see "Audio Data" packets being sent to the server and the respective ACK response when using Wireshark.


Is there anything that is conceptually different between encoding to a file or to a server when using the ffmpeg libav ?


I have a class for the audio encoding :


AudioEncoder(int sampleRate){
 av_log_set_level(AV_LOG_DEBUG);
 m_formatContext = avformat_alloc_context();
 const AVOutputFormat* outputFormat = av_guess_format("flv", NULL, NULL);
 if (!outputFormat) {
 std::cerr << "Could not find aac output format" << std::endl;
 exit(-1);
 }
 m_formatContext->oformat = outputFormat;

 result = avio_open2(&m_ioContext, "rtmp://localhost/live/test",AVIO_FLAG_WRITE, NULL, NULL);
 if( result < 0){
 std::cerr << "Could not open output stream: " << error_string(result) << std::endl;
 exit(-1); 
 }
 m_formatContext->pb = m_ioContext;
 
 const AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_AAC);
 if(!codec){
 std::cerr << "Codec not found." << std::endl;
 exit(-1);
 }
 
 m_codecContext = avcodec_alloc_context3(codec);
 if (!m_codecContext) {
 std::cerr << "Could not alloc codec context" << std::endl;
 exit(-1);
 }
 AVChannelLayout layout;
 av_channel_layout_default(&layout, 1);
 m_codecContext->sample_fmt = AV_SAMPLE_FMT_FLTP;
 m_codecContext->bit_rate = 128000;
 m_codecContext->sample_rate = sampleRate;
 m_codecContext->ch_layout = layout;

 m_avStream = avformat_new_stream(m_formatContext, codec);
 if (!m_avStream) {
 std::cerr << "Could not create stream." << std::endl;
 exit(-1);
 } 
 result = avcodec_parameters_from_context(m_avStream->codecpar, m_codecContext);
 if ( result < 0) {
 std::cerr << "Failed to copy codec parameters to stream: " << error_string(result) << std::endl;
 exit(-1);
 }
 m_avStream->time_base = AVRational{1, m_codecContext->sample_rate};

 result = avcodec_open2(m_codecContext, codec, NULL);
 if ( result < 0) {
 std::cerr << "Failed to open codec: "<< error_string(result) << std::endl;
 exit(-1);
 }

 result = avformat_write_header(m_formatContext, NULL);
 if ( result < 0) {
 std::cerr << "Failed to write format header: "<< error_string(result) << std::endl;
 exit(-1);
 }
}



And an Encode function that is called by miniaudio :


void Encode(const void* data, unsigned int frames){
 AVPacket* packet = av_packet_alloc();
 if (!packet) {
 std::cerr << "Error allocating packet" << std::endl;
 return;
 }

 AVFrame* frame = av_frame_alloc();
 if (!frame) {
 std::cerr << "Error allocating frame" << std::endl;
 av_packet_free(&packet);
 return;
 }
 frame->format = m_codecContext->sample_fmt;
 frame->ch_layout = m_codecContext->ch_layout;
 frame->sample_rate = m_codecContext -> sample_rate;
 frame->nb_samples = frames;
 if (frames) {
 int result = av_frame_get_buffer(frame, 0);
 if ( result < 0) {
 std::cerr << "Error allocating frame buffer: " << error_string(result) << std::endl;
 av_frame_free(&frame);
 av_packet_free(&packet);
 return;
 }
 }
 frame->data[0] = (uint8_t*)data;

 int result = avcodec_send_frame(m_codecContext, frame); 
 if (result < 0) {
 std::cerr << "Error sending frame to encoder: " << error_string(result) << std::endl; 
 }

 result = avcodec_receive_packet(m_codecContext, packet); 
 if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) {
 std::cout << "EAGAIN" << std::endl;
 // If we get AVERROR_EAGAIN, the encoder needs more data, so we'll return and try again later
 av_frame_free(&frame);
 av_packet_free(&packet);
 return;
 } else if (result < 0) {
 std::cerr << "Error receiving packet from encoder: " << error_string(result) << std::endl;
 av_frame_free(&frame);
 av_packet_free(&packet);
 return;
 }
 else {
 packet->stream_index = m_avStream->index;
 packet->pts = av_rescale_q(frames, AVRational{1, m_codecContext->sample_rate}, m_avStream->time_base);
 packet->dts = packet->pts;
 packet->duration = av_rescale_q(1024, AVRational{1, m_codecContext->sample_rate}, m_avStream->time_base);

 result = av_write_frame(m_formatContext, packet);
 if ( result < 0) {
 std::cerr << "Error writing frame: " << error_string(result) << std::endl;
 }
 }
 //Clean up resources
 av_frame_free(&frame);
 av_packet_unref(packet);
 av_packet_free(&packet);
}



On a final note, I have been able to stream to a TCP server developed in Golang using ADTS as the container and the same method, but I've decided to delegate the task to Nginx.