
Recherche avancée
Médias (91)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
-
USGS Real-time Earthquakes
8 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (20)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)
Sur d’autres sites (5378)
-
h.264 lossless video in python with ffmpeg
7 mars 2015, par OjtwistI have raw video files which I encoded via ffmpeg (lossless) :
ffmpeg -i test.avi -c:v libx264 -preset veryslow -crf 0 output.mkv
Now I tried to read these in python :
FFMPEG_BIN = "ffmpeg"
command = [FFMPEG_BIN,
'-i',path,
'-f', 'image2pipe',
'-pix_fmt','yuv444p',
'-r',framerate,
'-ss',startposition,
'-vcodec','rawvideo','-']
pipe = sp.Popen(command,stdout=sp.PIPE,bufsize=10**8)
while True:
raw_image = pipe.stdout.read(640*480*3)
image = np.fromstring(raw_image,dtype='uint8')
image = image.reshape((480,640,3))I can’t find the good command to get the video lossless in python. If I try it as mentioned above and show it with matplotlib, I get :
If I set -
vcodec
tolibx264
I get noise.If i set
-pix_fmt
torgb24
, I get a normal looking image, but I can see some artifact due to the color conversion.What is the command I am looking for ?
extra info, the output of the encoding (initial raw video ==> lossless h.264) :
worker@worklati:~/data/DMG/test$ ffmpeg -i test.avi -c:v libx264 -preset veryslow -crf 0 output.mkv
ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 11 2015 17:53:45 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libpulse --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, avi, from 'test.avi':
Duration: 00:10:25.17, start: 0.000000, bitrate: 44237 kb/s
Stream #0:0: Video: rawvideo, bgr24, 640x480, 6 fps, 6 tbr, 6 tbn, 6 tbc
File 'output.mkv' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1fd7160] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x1fd7160] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
[libx264 @ 0x1fd7160] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=0 mixed_ref=1 me_range=24 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=6 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'output.mkv':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 640x480, q=-1--1, 6 fps, 1k tbn, 6 tbc
Metadata:
encoder : Lavc56.13.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 3751 fps= 40 q=-1.0 Lsize= 133724kB time=00:10:25.16 bitrate=1752.3kbits/s
video:133691kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.024307%
[libx264 @ 0x1fd7160] frame I:16 Avg QP: 0.00 size: 58298
[libx264 @ 0x1fd7160] frame P:3735 Avg QP: 0.00 size: 36403
[libx264 @ 0x1fd7160] mb I I16..4: 65.3% 6.9% 27.7%
[libx264 @ 0x1fd7160] mb P I16..4: 3.0% 2.1% 0.2% P16..4: 71.2% 0.8% 22.4% 0.0% 0.0% skip: 0.1%
[libx264 @ 0x1fd7160] 8x8 transform intra:36.9% inter:49.5%
[libx264 @ 0x1fd7160] coded y,u,v intra: 79.3% 0.0% 0.0% inter: 97.6% 0.0% 0.0%
[libx264 @ 0x1fd7160] i16 v,h,dc,p: 20% 3% 76% 1%
[libx264 @ 0x1fd7160] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 5% 8% 80% 1% 1% 2% 1% 1% 1%
[libx264 @ 0x1fd7160] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 28% 16% 5% 7% 8% 5% 4% 5%
[libx264 @ 0x1fd7160] Weighted P-Frames: Y:0.2% UV:0.0%
[libx264 @ 0x1fd7160] ref P L0: 63.2% 0.0% 14.2% 5.3% 4.0% 3.2% 2.6% 1.1% 1.0% 1.0% 0.9% 1.1% 0.7% 0.6% 0.6% 0.6%
[libx264 @ 0x1fd7160] kb/s:1751.85 -
ffmpeg concat + scale2ref, reduced framerate
15 décembre 2020, par Erwan DouailleI would like to concatenate multiple videos with differents aspect ratio, framerates, etc.
The working solution is scale2ref option with black background, no re-scale and concat.


If I use my command line with movie1.mp4 (30fps 1920x1080 2sec) and movie2.mp4 (25fps 800x600 3sec) I except a final output at 25fps 1920x1080 5sec. This part works well.


Then if I use my command line with movie1.mp4 (30fps 1920x1080 2sec) and movie2.mp4 (30fps 1920x1080 3sec) I except a final output at 30fps 1920x1080 5sec. But for an unknown reason my final output is 25fps 1920x1080 5 sec.


I tried with a copy of movie1.mp4 and rename it to movie2.mp4 to ensure they are both perfectly identical and got the same issue.


Input #0, lavfi, from 'color':
 Duration: N/A, start: 0.000000, bitrate: N/A
 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from './1.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.29.100
 Duration: 00:00:02.47, start: 0.000000, bitrate: 6737 kb/s
 Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 6567 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #1:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
 Metadata:
 handler_name : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from './2.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.29.100
 Duration: 00:00:02.47, start: 0.000000, bitrate: 6737 kb/s
 Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 6567 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #2:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
 Metadata:
 handler_name : SoundHandler



Output file :


[libx264 @ 000001a689d44180] using SAR=1/1
[libx264 @ 000001a689d44180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001a689d44180] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 000001a689d44180] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=24 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to './out.mp4':
 Metadata:
 encoder : Lavf58.29.100
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
 Metadata:
 encoder : Lavc58.54.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 encoder : Lavc58.54.100 aac
frame= 124 fps= 72 q=-1.0 Lsize= 3842kB time=00:00:04.84 bitrate=6502.6kbits/s speed=2.79x



Here is my command line :


ffmpeg -y -f lavfi -i color -i ./1.mp4 -i ./2.mp4 -filter_complex_script ./3.txt ./out.mp4



The content of filter comple script :


[0][1]scale2ref[canvas][vid1];[canvas][2]scale2ref='max(iw,main_w)':'max(ih,main_h)'[canvas][vid2];[canvas]split=2[canvas1][canvas2];[canvas1][vid1]overlay=x='(W-w)/2':y='(H-h)/2':shortest=1[vid1];[canvas2][vid2]overlay=x='(W-w)/2':y='(H-h)/2':shortest=1[vid2];[vid1][vid2]concat=n=2:v=1,setsar=1



I´m quite sure it´s related to the lavfi input but I don´t know how to enforce it to be the best framerate available.


Is it possible to enforce the "best" framerate available ?
Something like :


- 

- 30fps + 30fps = 30fps
- 25fps + 25fps = 25fps
- 25fps + 30fps = 30fps (or maybe 25 with perfect down sampling for the 30fps video)








My ffmpeg commands are programmaticaly generated. Any automatic solution is prefered.


-
Invalid data when converting mp4 to x264 with ffmpeg but fine when converting flv to x264
15 octobre 2018, par JulienI have a PHP script that converts uploaded videos to x264, it works fine if I upload an FLV, but with an MP4 it doesn’t work, here’s the command and output :
Command :
ffmpeg -y -i ../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4 -crf 0 -vcodec libx264 -movflags faststart ../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4 2>&1
Output :
ffmpeg version N-67321-ge5054c8 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 1 2014 12:53:28 with gcc 4.8.2 (GCC) 20140120 (Red Hat 4.8.2-16)
configuration: --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264
libavutil 54. 11.100 / 54. 11.100
libavcodec 56. 10.100 / 56. 10.100
libavformat 56. 11.101 / 56. 11.101
libavdevice 56. 2.100 / 56. 2.100
libavfilter 5. 2.100 / 5. 2.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
creation_time : 2018-10-08 12:03:53
encoder : Lavf56.15.102
Duration: 00:03:03.08, start: 0.023129, bitrate: 1647 kb/s
Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 720x404 [SAR 1:1 DAR 180:101], 1547 kb/s, 24 fps, 24 tbr, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2018-10-08 12:03:53
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2018-10-08 12:03:53
handler_name : SoundHandler
[libx264 @ 0x1f0a080] using SAR=1/1
[libx264 @ 0x1f0a080] using cpu capabilities: MMX2 SSE Cache64
[libx264 @ 0x1f0a080] profile High 4:4:4 Predictive, level 3.0, 4:2:0 8-bit
[libx264 @ 0x1f0a080] 64 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=0 mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, mp4, to '../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf56.11.101
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x404 [SAR 1:1 DAR 180:101], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2018-10-08 12:03:53
handler_name : VideoHandler
encoder : Lavc56.10.100 libx264
Stream #0:1(und): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
creation_time : 2018-10-08 12:03:53
handler_name : SoundHandler
encoder : Lavc56.10.100 libfdk_aac
Stream mapping:
Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[mpeg4 @ 0x2004420] ac-tex damaged at 1 1
[mpeg4 @ 0x2004420] Error at MB: 47
[mpeg4 @ 0x2004420] concealing 1170 DC, 1170 AC, 1170 MV errors in P frame
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1ed3ec0] stream 1, offset 0xee5b: partial file
../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1ed3ec0] stream 0, offset 0xef98: partial file
../../flv/rjaRGKzSMtksUJ4kGbsLMYEcr.mp4: Invalid data found when processing input
[mp4 @ 0x1f08f40] Starting second pass: moving the moov atom to the beginning of the file
frame= 3 fps=0.0 q=-1.0 Lsize= 116kB time=00:00:00.12 bitrate=7585.3kbits/s dup=1 drop=0
video:113kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.171168%
[libx264 @ 0x1f0a080] frame I:1 Avg QP: 0.00 size:113785
[libx264 @ 0x1f0a080] frame P:2 Avg QP: 0.00 size: 518
[libx264 @ 0x1f0a080] mb I I16..4: 38.4% 0.0% 61.6%
[libx264 @ 0x1f0a080] mb P I16..4: 0.2% 0.0% 0.1% P16..4: 1.2% 0.1% 0.2% 0.0% 0.0% skip:98.3%
[libx264 @ 0x1f0a080] 8x8 transform intra:0.0% inter:3.1%
[libx264 @ 0x1f0a080] coded y,uvDC,uvAC intra: 91.6% 88.7% 88.7% inter: 0.7% 0.2% 0.2%
[libx264 @ 0x1f0a080] i16 v,h,dc,p: 46% 53% 1% 0%
[libx264 @ 0x1f0a080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 44% 40% 3% 2% 3% 2% 2% 2% 2%
[libx264 @ 0x1f0a080] i8c dc,h,v,p: 2% 55% 43% 0%
[libx264 @ 0x1f0a080] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x1f0a080] kb/s:7348.61As you can see there are some errors, there. I’ve tried with several different mp4 files, from different sources so it’s not a problem of the video files.
I’ve also tried without the
-movflags faststart
option, also tried with-q:v 0
instead of-crf 0
, nothing works, but like stated above, it works from FLV -> MP4, what am i doing wrong here ?PS : By "Nothing works" I mean the resulting MP4 plays for 1 frame in the browser and stops.