
Recherche avancée
Autres articles (101)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
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 (...)
Sur d’autres sites (12317)
-
ffmpeg : non monotonically increasing dts
27 décembre 2023, par pan-sultanI compiled ffmpeg on my own to dig into the problem but the same problem is reproducible on deb packages installed from debian 12 repository. I use some code that converts mov to mp4 file. I do not know too much details because I am not the author and that code is huge. But I just need to research the root cause of the bug described below.


So, the code use next sequence of functions


av_packet_rescale_ts() // replace packet 
av_write_frame() // write frame



But at some period of time av_write_frame() fails with error Application provided invalid, non monotonically increasing dts to muxer in stream ... : 252003 >= 252003
return value is EINVAL


av_packet_rescale_ts() looks inside like this :


void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
{
 if (pkt->pts != AV_NOPTS_VALUE)
 pkt->pts = av_rescale_q(pkt->pts, src_tb, dst_tb);
 if (pkt->dts != AV_NOPTS_VALUE) {
 pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb);
 }
...

int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
{
 return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
}



so I have focused only on call of av_rescale_q_rnd() for dts, here is simple code reproducing the problem.


#include 
#include 
#include 


/* the code copied from FFMPEG to reproduce the problem without usage of FFMPEG */
/* copied from FFMPEG START */

typedef struct AVRational{
 int num; ///< Numerator
 int den; ///< Denominator
} AVRational;

#define FFMAX(a,b) ((a) > (b) ? (a) : (b))

enum AVRounding {
 AV_ROUND_ZERO = 0, ///< Round toward zero.
 AV_ROUND_INF = 1, ///< Round away from zero.
 AV_ROUND_DOWN = 2, ///< Round toward -infinity.
 AV_ROUND_UP = 3, ///< Round toward +infinity.
 AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
 AV_ROUND_PASS_MINMAX = 8192,
};


int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
{
 int64_t r = 0;

 if (c <= 0 || b < 0 || !((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4))
 return INT64_MIN;

 if (rnd & AV_ROUND_PASS_MINMAX) {
 if (a == INT64_MIN || a == INT64_MAX)
 return a;
 rnd -= AV_ROUND_PASS_MINMAX;
 }

 if (a < 0)
 return -(uint64_t)av_rescale_rnd(-FFMAX(a, -INT64_MAX), b, c, rnd ^ ((rnd >> 1) & 1));

 if (rnd == AV_ROUND_NEAR_INF)
 r = c / 2;
 else if (rnd & 1)
 r = c - 1;

 if (b <= INT_MAX && c <= INT_MAX) {
 if (a <= INT_MAX)
 return (a * b + r) / c;
 else {
 int64_t ad = a / c;
 int64_t a2 = (a % c * b + r) / c;
 if (ad >= INT32_MAX && b && ad > (INT64_MAX - a2) / b)
 return INT64_MIN;
 return ad * b + a2;
 }
 } else {
 uint64_t a0 = a & 0xFFFFFFFF;
 uint64_t a1 = a >> 32;
 uint64_t b0 = b & 0xFFFFFFFF;
 uint64_t b1 = b >> 32;
 uint64_t t1 = a0 * b1 + a1 * b0;
 uint64_t t1a = t1 << 32;
 int i;

 a0 = a0 * b0 + t1a;
 a1 = a1 * b1 + (t1 >> 32) + (a0 < t1a);
 a0 += r;
 a1 += a0 < r;

 for (i = 63; i >= 0; i--) {
 a1 += a1 + ((a0 >> i) & 1);
 t1 += t1;
 if (c <= a1) {
 a1 -= c;
 t1++;
 }
 }
 if (t1 > INT64_MAX)
 return INT64_MIN;
 return t1;
 }
}

int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
 enum AVRounding rnd)
{
 int64_t b = bq.num * (int64_t)cq.den;
 int64_t c = cq.num * (int64_t)bq.den;
 return av_rescale_rnd(a, b, c, rnd);
}

/* copied from FFMPEG END */

int main() {
 AVRational stb;
 stb.den = 1000000;
 stb.num = 1;
 AVRational dtb;
 dtb.den = 90000;
 dtb.num = 1;


 int64_t a1 = 229312;
 int64_t a2 = 230336;
 printf("%li\n", av_rescale_q_rnd(a1, stb, dtb, AV_ROUND_NEAR_INF));
 printf("%li\n", av_rescale_q_rnd(a2, stb, dtb, AV_ROUND_NEAR_INF));
}



as you can see a1 and a2 different but return result is the same which leeds to non monotonical sequance.
Which is the correct way to provide monotonic sequence here to avoid EINVAL ?
All numbers are real.


-
ffmpeg - Frames flip upside-down when using -c:v copy
26 décembre 2019, par BerndiI tried to just copy (a period of time of) an AVI-Video into another newly created AVI-file using ffmpeg’s copy option.
(On Windows 32-bit)ffmpeg -i "C:\Temp\zzz\myAvi.avi" -c copy -t 00:00:10 "C:\Temp\zzz\myAviNew.avi"
Why are the pictures flipped upside-down in the resulting file ?
(Also the generated new audio is a little distorted.)Using the same command again on the newly created file will not flip them back again - the pictures stay upside down.
Why this ? Is it a bug ?Console brings the following output :
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[avi @ 02537ba0] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'C:\Temp\zzz\Hase.avi':
Duration: 00:00:35.92, start: 0.000000, bitrate: 171375 kb/s
Stream #0:0: Video: rawvideo, bgra, 768x576, 12 tbr, 12 tbn, 12 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16
, 1411 kb/s
Output #0, avi, to 'C:\Temp\zzz\HaseNew.avi':
Metadata:
ISFT : Lavf55.0.100
Stream #0:0: Video: rawvideo, bgra, 768x576, q=2-31, 12 tbn, 12 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 141
1 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 11 fps=0.0 q=-1.0 size= 19162kB time=00:00:00.91 bitrate=171242.4kbit
frame= 16 fps= 12 q=-1.0 size= 27874kB time=00:00:01.33 bitrate=171255.5kbit
...
...
...
frame= 120 fps=5.4 q=-1.0 size= 209083kB time=00:00:09.99 bitrate=171280.6kbit
frame= 121 fps=5.5 q=-1.0 Lsize= 210834kB time=00:00:10.08 bitrate=171288.2kbi
ts/s
video:209088kB audio:1723kB subtitle:0 global headers:0kB muxing overhead 0.0112
76%
C:\WINDOWS\system32> -
ffmpeg - Frames flip upside-down when using -c:v copy
7 mars 2014, par user3384390I tried to just copy (a period of time of) an AVI-Video into another newly created AVI-file using ffmpeg's copy option.
(On Windows 32-bit)ffmpeg -i "C:\Temp\zzz\myAvi.avi" -c copy -t 00:00:10 "C:\Temp\zzz\myAviNew.avi"
Why are the pictures flipped upside-down in the resulting file ?
(Also the generated new audio is a little distorted.)Using the same command again on the newly created file will not flip them back again - the pictures stay upside down.
Why this ? Is it a bug ?Console brings the following output :
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[avi @ 02537ba0] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'C:\Temp\zzz\Hase.avi':
Duration: 00:00:35.92, start: 0.000000, bitrate: 171375 kb/s
Stream #0:0: Video: rawvideo, bgra, 768x576, 12 tbr, 12 tbn, 12 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16
, 1411 kb/s
Output #0, avi, to 'C:\Temp\zzz\HaseNew.avi':
Metadata:
ISFT : Lavf55.0.100
Stream #0:0: Video: rawvideo, bgra, 768x576, q=2-31, 12 tbn, 12 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 141
1 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 11 fps=0.0 q=-1.0 size= 19162kB time=00:00:00.91 bitrate=171242.4kbit
frame= 16 fps= 12 q=-1.0 size= 27874kB time=00:00:01.33 bitrate=171255.5kbit
...
...
...
frame= 120 fps=5.4 q=-1.0 size= 209083kB time=00:00:09.99 bitrate=171280.6kbit
frame= 121 fps=5.5 q=-1.0 Lsize= 210834kB time=00:00:10.08 bitrate=171288.2kbi
ts/s
video:209088kB audio:1723kB subtitle:0 global headers:0kB muxing overhead 0.0112
76%
C:\WINDOWS\system32>