
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (51)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...) -
Initialisation de MediaSPIP (préconfiguration)
20 février 2010, parLors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)
Sur d’autres sites (8120)
-
FFMPEG:av_rescale_q - time_base difference
2 décembre 2020, par Michael IVI want to know once and for all, how time base calucaltion and rescaling works in FFMPEG. 
Before getting to this question I did some research and found many controversial answers, which make it even more confusing.
So based on official FFMPEG examples one has to





rescale output packet timestamp values from codec to stream timebase





with something like this :



pkt->pts = av_rescale_q_rnd(pkt->pts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt->duration = av_rescale_q(pkt->duration, *time_base, st->time_base);




But in this question a guy was asking similar question to mine, and he gave more examples, each of them doing it differently. And contrary to the answer which says that all those ways are fine, for me only the following approach works :



frame->pts += av_rescale_q(1, video_st->codec->time_base, video_st->time_base);




In my application I am generating video packets (h264) at 60 fps outside FFMPEG API then write them into mp4 container.



I set explicitly :



video_st->time_base = {1,60};
video_st->r_frame_rate = {60,1};
video_st->codec->time_base = {1 ,60};




The first weird thing I see happens right after I have written header for the output format context :



AVDictionary *opts = nullptr;
int ret = avformat_write_header(mOutputFormatContext, &opts);
av_dict_free(&opts);




After that ,
video_st->time_base
is populated with :


num = 1;
den = 15360




And I fail to understand why.



I want someone please to exaplain me that.Next, before writing frame I calculate
PTS for the packet. In my case PTS = DTS as I don't use B-frames at all.



And I have to do this :



const int64_t duration = av_rescale_q(1, video_st->codec->time_base, video_st->time_base);
 totalPTS += duration; //totalPTS is global variable
 packet->pts = totalPTS ;
 packet->dts = totalPTS ;
 av_write_frame(mOutputFormatContext, mpacket);




I don't get it,why codec and stream have different time_base values even though I explicitly set those to be the same. And because I see across all the examples that
av_rescale_q
is always used to calculate duration I really want someone to explain this point.


Additionally, as a comparison, and for the sake of experiment, I decided to try writing stream for WEBM container. So I don't use libav output stream at all.
I just grab the same packet I use to encode MP4 and write it manually into EBML stream. In this case I calculate duration like this :



const int64_t duration =
 ( video_st->codec->time_base.num / video_st->codec->time_base.den) * 1000;




Multiplication by 1000 is required for WEBM as the time stamps are presented in milliseconds in that container.And this works. So why in case of MP4 stream encoding there is a difference in time_base which has to be rescaled ?


-
FFmpeg : "Invalid data found when processing input" when reading video from memory
24 avril 2020, par DrawoceansI'm trying to read a mp4 video file from memory with C++ and FFmpeg library, but I got "Invalid data found when processing input" error. Here are my codes :



#include <cstdio>
#include <fstream>
#include <filesystem>

extern "C"
{
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
}

using namespace std;
namespace fs = std::filesystem;

struct VideoBuffer
{
 uint8_t* ptr;
 size_t size;
};

static int read_packet(void* opaque, uint8_t* buf, int buf_size)
{
 VideoBuffer* vb = (VideoBuffer*)opaque;
 buf_size = FFMIN(buf_size, vb->size);

 if (!buf_size) {
 return AVERROR_EOF;
 }

 printf("ptr:%p size:%zu\n", vb->ptr, vb->size);

 memcpy(buf, vb->ptr, buf_size);
 vb->ptr += buf_size;
 vb->size -= buf_size;

 return buf_size;
}

void print_ffmpeg_error(int ret)
{
 char* err_str = new char[256];
 av_strerror(ret, err_str, 256);
 printf("%s\n", err_str);
 delete[] err_str;
}

int main()
{
 fs::path video_path = "test.mp4";
 ifstream video_file;
 video_file.open(video_path);
 if (!video_file) {
 abort();
 }
 size_t video_size = fs::file_size(video_path);
 char* video_ptr = new char[video_size];
 video_file.read(video_ptr, video_size);
 video_file.close();

 VideoBuffer vb;
 vb.ptr = (uint8_t*)video_ptr;
 vb.size = video_size;

 AVIOContext* avio = nullptr;
 uint8_t* avio_buffer = nullptr;
 size_t avio_buffer_size = 4096;
 avio_buffer = (uint8_t*)av_malloc(avio_buffer_size);
 if (!avio_buffer) {
 abort();
 }

 avio = avio_alloc_context(avio_buffer, avio_buffer_size, 0, &vb, read_packet, nullptr, nullptr);

 AVFormatContext* fmt_ctx = avformat_alloc_context();
 if (!fmt_ctx) {
 abort();
 }
 fmt_ctx->pb = avio;

 int ret = 0;
 ret = avformat_open_input(&fmt_ctx, nullptr, nullptr, nullptr);
 if (ret < 0) {
 print_ffmpeg_error(ret);
 }

 avformat_close_input(&fmt_ctx);
 av_freep(&avio->buffer);
 av_freep(&avio);
 delete[] video_ptr;
 return 0;
}
</filesystem></fstream></cstdio>



And here is what I got :



ptr:000001E10CEA0070 size:4773617
ptr:000001E10CEA1070 size:4769521
...
ptr:000001E10D32D070 size:1777
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001e10caaeac0] moov atom not found
Invalid data found when processing input




FFmpeg version is 4.2.2, with Windows 10 and Visual Studio 2019 in x64 Debug mode. FFmpeg library is the Windows compiled shared library from FFmpeg homepage. Some codes are from official example
avio_reading.c
. Target MP4 file can be played normally by VLC player so I think the file is OK. Is anywhere wrong in my codes ? Or is it an FFmpeg library problem ?

-
FFMpeg Concatenation Filters : Stream specifier ':0' in filtergraph matches no streams
8 décembre 2018, par Anthony EdenI am developing an application that relies heavily on FFMpeg to perform various transformations on audio files. I am currently testing my FFMpeg configuration on the command line.
I am trying to concatenate multiple audio files which are in different formats (Primarily MP3, MP2 & WAV). I have been using the official TRAC documentation (https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join%2C%20merge)%20media%20files#differentcodec) to help me with this and have created the following command :
ffmpeg -i OHIn.wav -i OHOut.wav -filter_complex '[0:0] [1:0] concat=n=2:a=1 [a]' -map '[a]' output.wav
However, when I run this on Mac OS X using version 2.0.1 of FFMpeg, I get the following error message :
Stream specifier ':0' in filtergraph description [0:0] [1:0] concat=n=2:a=1 [a] matches no streams.
Here is my full output from the terminal :
~/ffmpeg -i OHIn.wav -i OHOut.wav -filter_complex '[0:0] [1:0] concat=n=2:a=1 [a]' -map '[a]' output.wav
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 15 2013 10:56:46 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'OHIn.wav':
Duration: 00:00:06.71, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'OHOut.wav':
Duration: 00:00:07.19, bitrate: 1411 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream specifier ':0' in filtergraph description [0:0] [1:0] concat=n=2:a=1 [a] matches no streams.I do not understand why this does not work. FFMpeg shows that the streams 0:0 and 1:0 exist in the source files. The only other similar problems online have surrounded the use of the single quote in Windows, however testing of this confirm it does not apply to my Mac command line.
Any help would be much appreciated.