
Recherche avancée
Autres articles (33)
-
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 (...) -
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (5480)
-
Duration of wav file saved in S3 using AWS Lambda
3 juin 2021, par Salim ShamimObjective


To calculate the duration of a wav file which is saved in S3 by AWS Lambda using node.js. I had to add
ffmpeg
andffprobe
executable inside a lambda layer (Downloaded linux-64 version from here). These files could be found in/opt
folder on lambda file system.

What I have tried


I have been trying using ffprobe in numerous ways, but I get
Invalid Data
as error.
Here's one example

const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');

exports.handler = async function(event) {
 let path = await load();
 console.log(`Saved Path ${path}`);

 ffmpeg.setFfmpegPath('/opt/ffmpeg');
 ffmpeg.setFfprobePath("/opt/ffprobe");

 let dur = await duration(path).catch(err => {
 console.log(err);
 })
 console.log(dur);
}


function duration(path) {
 return new Promise((resolve, reject) => {
 ffmpeg(path).ffprobe(path, function(err, metadata) {
 //console.dir(metadata); // all metadata
 if (err) {
 reject(err);
 }
 else {
 resolve(metadata.format.duration);

 }
 });
 })
}

async function listFiles(path) {
 console.log('list files');
 return new Promise((resolve, reject) => {
 fs.readdir(path, (err, files) => {
 if (err) {
 console.error('Error in readdir');
 reject(err);
 }
 else {
 console.log('recieved files');
 resolve(files);
 }

 });

 });

}

async function load() {
 return new Promise((resolve, reject) => {
 let params = {
 Key: 'Fanfare60.wav',
 Bucket: 'samplevideosshamim'
 };
 console.log(`Getting s3 object : ${JSON.stringify(params)}`);
 s3.getObject(params, (err, data) => {
 if (err) {
 console.error(err);
 reject(err);
 }
 else if (data) {
 console.log('Recieved Data');
 let path = `/tmp/${params.Key}`;
 console.log('Path: ' + path);
 fs.writeFileSync(path, data.body);
 resolve(path);
 }
 });
 });

}



Error :


Error: ffprobe exited with code 1
ffprobe version 4.2.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2019 the FFmpeg developers
 built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100
/tmp/Fanfare60.wav: Invalid data found when processing input

 at ChildProcess.<anonymous> (/var/task/node_modules/fluent-ffmpeg/lib/ffprobe.js:233:22)
 at ChildProcess.emit (events.js:314:20)
 at ChildProcess.EventEmitter.emit (domain.js:483:12)
 at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
</anonymous>


I am guessing it doesn't support
wav
format, but internet searches provide no proof of that.

A point to note here is, I was able to get the duration of a local file when I ran this code on my local machine, but I have a windows machine, so perhaps only linux executable of ffprobe has issue ?


Possible Solutions I am looking for


- 

- Is there a way to specify format ?
- Can I use a different library (code example for the same) ?
- Any possible way to get duration of a
wav
file in the mentioned scenario (AWS Lambda NodeJS and S3 file (private file) ?








-
Merge Audio with Video is not working probably using android 9 & 8
22 juillet 2021, par ebdaa appI am trying to use the following code to merge audio with video,


cmd = "-stream_loop -1 -i " + videoUri + " -i " + audioPath + " -shortest -map 0:v:0 -map 1:a:0 -y " + videoOutputPath;

 long executionId = FFmpeg.executeAsync(cmd, new ExecuteCallback() {

 @Override
 public void apply(final long executionId, final int returnCode) {
 if (returnCode == RETURN_CODE_SUCCESS) {
 playVedio(videoOutputPath);
 } else {
 ErrorLogger();
 }
 }
 });



as you can see the above code does the following things :


- 

- replace audio in video with new one.
- loop the video until the new audio ends.






everything works perfectly when trying to run the code using both android 11 and 10 , however , when try to use android 9 or 8 , the first and the last 2 seconds of the new audio will be trimmed in the generated video and I am not able to know why


I am using 4.4 version of the mobile-ffmpeg


com.arthenica:mobile-ffmpeg-full:4.4



please find the log from android 8/9


I/mobile-ffmpeg: ffmpeg version v4.4-dev-416
 Copyright (c) 2000-2020 the FFmpeg developers
 built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
 configuration: --cross-prefix=i686-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=i686 --cpu=i686 --cc=i686-linux-android24-clang --cxx=i686-linux-android24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/cpu-features/lib -lndk_compat' --target-os=android --disable-neon --disable-asm --disable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
 libavutil 56. 55.100 / 56. 55.100
 libavcodec 58. 96.100 / 58. 96.100
 libavformat 58. 48.100 / 58. 48.100
 libavdevice 58. 11.101 / 58. 11.101
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
 I/mobile-ffmpeg: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Download/Videoes/share_video_2.mp4':
 Metadata:
 major_brand : 
 isom
 minor_version : 
 512
 compatible_brands: 
 isomiso2avc1mp41
 encoder : 
 I/mobile-ffmpeg: Lavf58.44.100
 Duration: 
 00:00:08.21
 , start: 
 0.000000
 , bitrate: 
 477 kb/s
 Stream #0:0
 (und)
 : Video: h264 (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 473 kb/s
 , 
 29.97 fps, 
 29.97 tbr, 
 30k tbn, 
 59.94 tbc
 (default)
 Metadata:
 handler_name : 
 VideoHandler
 I/mobile-ffmpeg: Input #1, mp3, from '/storage/emulated/0/Download/001001.mp3':
 I/mobile-ffmpeg: Metadata:
 album : 
 Mishary Alafasi Musshaf
 artist : 
 Mishary Alafasi
 comment : 
 www.mp3quran.net
 genre : 
 Quran
 title : 
 Al-Fatihah
 date : 
 2007
 encoder : 
 Lavf58.48.100
 Duration: 
 00:00:12.41
 , start: 
 0.011995
 , bitrate: 
 132 kb/s
 Stream #1:0
 I/mobile-ffmpeg: : Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
 Metadata:
 encoder : 
 Lavf
 Stream #1:1
 : Video: png, pal8(pc), 200x159 [SAR 2835:2835 DAR 200:159]
 , 
 90k tbr, 
 90k tbn, 
 90k tbc
 (attached pic)
 Metadata:
 comment : 
 Cover (front)
 I/mobile-ffmpeg: Stream mapping:
 Stream #0:0 -> #0:0
 (h264 (native) -> mpeg4 (native))
 Stream #1:0 -> #0:1
 (mp3 (mp3float) -> aac (native))
 Press [q] to stop, [?] for help
 I/mobile-ffmpeg: frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A 
 W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0xd429d2e0] sws_param option is deprecated and ignored
 D/EGL_emulation: eglMakeCurrent: 0xf08c6ee0: ver 2 0 (tinfo 0xf08d2810)
 I/mobile-ffmpeg: Output #0, mp4, to '/storage/emulated/0/Download/v001001.mp4':
 Metadata:
 major_brand : 
 isom
 minor_version : 
 I/mobile-ffmpeg: 512
 compatible_brands: 
 isomiso2avc1mp41
 encoder : 
 Lavf58.48.100
 Stream #0:0
 (und)
 : Video: mpeg4 (mp4v / 0x7634706D), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s
 , 
 29.97 fps, 
 30k tbn, 
 29.97 tbc
 (default)
 Metadata:
 handler_name : 
 VideoHandler
 encoder : 
 Lavc58.96.100 mpeg4
 Side data:
 I/mobile-ffmpeg: 
 cpb: 
 bitrate max/min/avg: 0/0/200000 buffer size: 0 
 vbv_delay: N/A
 I/mobile-ffmpeg: Stream #0:1
 : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
 Metadata:
 encoder : 
 Lavc58.96.100 aac
 I/mobile-ffmpeg: frame= 83 fps=0.0 q=30.2 size= 0kB time=00:00:02.78 bitrate= 0.1kbits/s speed=5.54x 
 I/mobile-ffmpeg: frame= 199 fps=198 q=31.0 size= 256kB time=00:00:06.64 bitrate= 315.8kbits/s speed=6.61x 
 I/mobile-ffmpeg: frame= 300 fps=199 q=31.0 size= 512kB time=00:00:10.00 bitrate= 419.1kbits/s speed=6.65x 
 I/mobile-ffmpeg: frame= 372 fps=204 q=31.0 Lsize= 733kB time=00:00:12.39 bitrate= 484.5kbits/s speed= 6.8x 
 video:526kB audio:195kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
 1.630239%
 I/mobile-ffmpeg: [aac @ 0xd431fc00] Qavg: 164.571



-
Audio on TS File Falls Progressively Out of Sync
8 août 2021, par Steve BrownI would really appreciate some help with this...


I have a .ts file I've downloaded from the internet, when I play in Quicktime the video progressively falls behind the audio. It becomes noticeable after a couple of minutes and is a few seconds out after about ten minutes. It plays fine in VLC, but I want to be able to play on my AppleTV which does the same as Quicktime.


I've tried everything I can think of to resolve...


- 

- Convert with VLC, which does work, but every few seconds the audio skips.
- Convert with Handbrake, which again works, but every few seconds the audio skips like with VLC.
- Convert with FFMpeg using -async, but I get the same result again with the audio skips.
- Extracted the audio and video to two separate files and recreated a new file with FFMpeg, this makes no difference and is the same as playing the original file.
- Tried "stretching" the audio with FFMpeg using "aresample=async=1000", which synchronises but the audio is distorted.












I think the audio skips I'm getting from the -async option are caused because the audio is being trimmed to sync with the video. What I want to do is adjust the video to fit with the audio and leave the audio unchanged.


I've tried to do this with -vsync, but the the results are the same as the original file. The FFMpeg user guide says the following :


With -map you can select from which stream the timestamps should be taken. You can leave either video or audio unchanged and sync the remaining stream(s) to the unchanged one.


But I cannot figure out the syntax. This is what I'm trying but the output is the same as the original...


ffmpeg -vsync 1 -I test.ts -map 0:1 -map 0:0 -y test.mp4


I've tried the above using vsync with 0, 1 and 2, but the result is still the same.


Could anyone please help me with the syntax to sync the video stream to the audio stream and leave the audio unchanged ? Or suggest an alternative method I could use ?


Any help would be really, really appreciated. Thanks.


Here is the ffprobe for test.ts...


ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration : —prefix=/usr/local/Cellar/ffmpeg/4.4_1 —enable-shared —enable-pthreads —enable-version3 —enable-avresample —cc=clang —host-cflags= —host-ldflags= —enable-ffplay —enable-gnutls —enable-gpl —enable-libaom —enable-libbluray —enable-libdav1d —enable-libmp3lame —enable-libopus —enable-librav1e —enable-librubberband —enable-libsnappy —enable-libsrt —enable-libtesseract —enable-libtheora —enable-libvidstab —enable-libvorbis —enable-libvpx —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxml2 —enable-libxvid —enable-lzma —enable-libfontconfig —enable-libfreetype —enable-frei0r —enable-libass —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libspeex —enable-libsoxr —enable-libzmq —enable-libzimg —disable-libjack —disable-indev=jack —enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mpegts, from 'TEst.ts' :
Duration : 02:13:05.51, start : 1.406000, bitrate : 4579 kb/s
Program 1
Metadata :
service_name : Service01
service_provider : FFmpeg
Stream #0:0[0x100] : Video : h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080, 23.98 tbr, 90k tbn, 1411200000.00 tbc
Stream #0:1[0x101] : Audio : aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 195 kb/s