
Recherche avancée
Autres articles (57)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Les images
15 mai 2013
Sur d’autres sites (6697)
-
Creating video thumbnail with ffmpeg from buffer
28 juillet 2021, par J. CarpenterAttempting to create a child process which spawns ffmpeg command. Should use the buffer from fs.readFile to write to stdin. The
-i -
flag tells ffmpeg to source input from stdin but nothing is happening when running this code.

If replace
-i -
with-i test.mp4
this script works perfectly.

What is wrong with the write to stdin which is not allowing code to generate thumbnail ?


(async () => {
 const spawn = require('child_process').spawn;
 const fs = require('fs/promises');
 const buffer = await fs.readFile('test.mp4');
 await new Promise((resolve) => {
 console.log('Spawning process');
 const process = spawn('ffmpeg',
 [
 '-ss', '00:00:01',
 '-i', '-',
 '-s', '256x256',
 '-vframes', '1',
 '-f', 'image2',
 'output.png'
 ]);
 process.stdin.write(buffer);
 process.stdin.end();
 process.on('close', (done) => {
 console.log("Process closed: ", done);
 resolve();
 });
 });
})();



Edit :


Also tried this :


const ffmpeg = require('fluent-ffmpeg');
module.exports =
 async (stream) => {
 ffmpeg(stream)
 .addOption('-f','rawvideo')
 .inputFormat('mov')
 .toFormat('mp4')
 .thumbnail({
 count:1,
 size:'256x256',
 filename:'test.png',
 timemarks:["00:00:03"]
 })
 .on('stdout',(stdout)=>{
 console.log(stdout);
 })
 .on('stderr',(err)=>{
 console.log(err);
 });
 }



With this error output :


ffmpeg version N-102781-g05f9b3a0a5 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 10-win32 (GCC) 20210408
 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp
 libavutil 57. 0.100 / 57. 0.100
 libavcodec 59. 1.102 / 59. 1.102
 libavformat 59. 3.101 / 59. 3.101
 libavdevice 59. 0.100 / 59. 0.100
 libavfilter 8. 0.102 / 8. 0.102
 libswscale 6. 0.100 / 6. 0.100
 libswresample 4. 0.100 / 4. 0.100
 libpostproc 56. 0.100 / 56. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025220812340] stream 0, offset 0x24: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025220812340] Could not find codec parameters for stream 1 (Video: h264 (avc1 / 0x31637661), none(bt709), 640x360, 2630 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
 Metadata:
 major_brand : qt
 minor_version : 0
 compatible_brands: qt
 creation_time : 2021-07-25T11:06:03.000000Z
 Duration: 00:00:17.38, start: 0.000000, bitrate: N/A
 Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
 Metadata:
 creation_time : 2021-07-25T11:06:03.000000Z
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]
 Stream #0:1(und): Video: h264 (avc1 / 0x31637661), none(bt709), 640x360, 2630 kb/s, 29.98 fps, 29.97 tbr, 600 tbn (default) 
 Metadata:
 creation_time : 2021-07-25T11:06:03.000000Z
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 encoder : H.264
 Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
 Metadata:
 creation_time : 2021-07-25T11:06:03.000000Z
 handler_name : Core Media Metadata
 Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
 Metadata:
 creation_time : 2021-07-25T11:06:03.000000Z
 handler_name : Core Media Metadata
Stream mapping:
 Stream #0:1 (h264) -> scale
 split -> Stream #0:0 (libx264)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000025220812340] stream 1, offset 0xb1bf9: partial file
pipe:0: Invalid data found when processing input
Cannot determine format of input stream 0:1 after EOF
Error marking filters as finished
Conversion failed!

events.js:292
 throw er; // Unhandled 'error' event
 ^

Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input
Cannot determine format of input stream 0:1 after EOF
Error marking filters as finished
Conversion failed!



-
libvorbis complains “more samples than frame size”
11 août 2021, par YozI am trying to figure out what's wrong with my command to encode into theora+vorbis. I am able to demonstrate the issue with minimum code as following :


encoding audio followed by video works ok :


ffmpeg -filter_complex "smptehdbars=size=1280x720:rate=30000/1001[v];sine=beep_factor=2[a]" -map [a] -map [v] -vcodec libtheora -acodec libvorbis -t 3 -f ogg map-audio-video.ogg -y



however video followed by audio does not work (swapped order of -map) :


ffmpeg -filter_complex "smptehdbars=size=1280x720:rate=30000/1001[v];sine=beep_factor=2[a]" -map [v] -map [a] -vcodec libtheora -acodec libvorbis -t 3 -f ogg map-video-audio.ogg -y



and fails with the following error :


ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
Stream mapping:
 smptehdbars -> Stream #0:0 (libtheora)
 sine -> Stream #0:1 (libvorbis)
Press [q] to stop, [?] for help
[libvorbis @ 000001f846602fc0] more samples than frame size
Audio encoding failed
Conversion failed!



Any idea why the standard order video, audio breaks on samples vs. frame size ?


-
How to make ffmpeg re-encode an vp9 webm with alpha into a vp9 webm with alpha
28 juillet 2021, par LemmeTestThatI am trying to find optimal parameters for encoding a transparent video using ffmpeg in my scenario, and as a test, I have been re-encoding a pre-made transparent .webm (vp9 with alpha channel, made using python vidgear) like this :


$ /usr/bin/ffmpeg -i pre-made.webm pre-made-remade.webm
ffmpeg version 4.3.2-0york0~18.04 Copyright (c) 2000-2021 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
 configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, matroska,webm, from 'pre-made.webm':
 Metadata:
 ENCODER : Lavf58.45.100
 Duration: 00:01:11.04, start: 0.000000, bitrate: 1107 kb/s
 Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 1514x1910, SAR 1:1 DAR 757:955, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
 Metadata:
 alpha_mode : 1
 ENCODER : Lavc58.91.100 libvpx-vp9
 DURATION : 00:01:11.040000000
Stream mapping:
 Stream #0:0 -> #0:0 (vp9 (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55927254b0c0] v1.7.0
[libvpx-vp9 @ 0x55927254b0c0] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'pre-made-remade.webm':
 Metadata:
 encoder : Lavf58.45.100
 Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 1514x1910 [SAR 1:1 DAR 757:955], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
 Metadata:
 alpha_mode : 1
 DURATION : 00:01:11.040000000
 encoder : Lavc58.91.100 libvpx-vp9
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 1776 fps=8.9 q=0.0 Lsize= 6159kB time=00:01:11.00 bitrate= 710.6kbits/s speed=0.354x
video:6146kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214488%



According to the ffmpeg logs, the libvpx-vp9 is correctly being chosen, and alpha_mode is 1, which bodes well.
However, when actually viewing the video, the video is no longer trasparent.


How could I force ffmpeg to keep the alpha channel when re-encoding the video ? (This also applies when trying to merge audio into the .webm)


Bonus question : what arguments do you recommend for efficient vp9 encoding ? I have tried using
-threads 16 -speed 4 -tile-columns 6 -frame-parallel 1 -row-mt 1
but it seems to fail at fully utilizing all my CPU cores when encoding with the alpha channel (when piping frames from my python script).