
Recherche avancée
Médias (3)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (94)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...) -
MediaSPIP : Modification des droits de création d’objets et de publication définitive
11 novembre 2010, parPar défaut, MediaSPIP permet de créer 5 types d’objets.
Toujours par défaut les droits de création et de publication définitive de ces objets sont réservés aux administrateurs, mais ils sont bien entendu configurables par les webmestres.
Ces droits sont ainsi bloqués pour plusieurs raisons : parce que le fait d’autoriser à publier doit être la volonté du webmestre pas de l’ensemble de la plateforme et donc ne pas être un choix par défaut ; parce qu’avoir un compte peut servir à autre choses également, (...)
Sur d’autres sites (9236)
-
FFMPEG Video to Audio Conversion Results in Different Durations
10 juin 2020, par Eric JI am trying to covert an MP4 file into a mono WAV file sampled at 16,000 Hz.



When I run below code, the duration goes from 00:09:59.99 (MP4) to 00:09:57.64 (WAV). Its original, longer version goes from 00:48:37.46 (MP4) to 00:48:23.38 (WAV).



ffmpeg -i .mp4 -ac 1 -ar 16000 .wav




I've also tried below code. The result is much worse, going from 00:09:59.99 (MP4) to 00:12:56.29 (AAC).



ffmpeg -I .mp4 -vn -acodec copy .aac




Attaching the log :



Report written to "ffmpeg-20200610-093115.log"
Command line:
ffmpeg -i short.mp4 -ac 1 -ar 16000 short.wav -report
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
 built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
 libavutil 56. 22.100 / 56. 22.100
 libavcodec 58. 35.100 / 58. 35.100
 libavformat 58. 20.100 / 58. 20.100
 libavdevice 58. 5.100 / 58. 5.100
 libavfilter 7. 40.101 / 7. 40.101
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 3.100 / 5. 3.100
 libswresample 3. 3.100 / 3. 3.100
 libpostproc 55. 3.100 / 55. 3.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'short.mp4'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16000'.
Reading option 'short.wav' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url short.mp4.
Successfully parsed a group of options.
Opening an input file: short.mp4.
[NULL @ 0x7f98a3008200] Opening 'short.mp4' for reading
[file @ 0x7f98a2904440] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Processing st: 0, edit list 0 - media time: 0, duration: 7679872
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Processing st: 1, edit list 0 - media time: 1024, duration: 26459559
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] Before avformat_find_stream_info() pos: 11213917 bytes read:318782 seeks:1 nb_streams:2
[h264 @ 0x7f98a3808800] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7f98a3808800] nal_unit_type: 8(PPS), nal_ref_idc: 3
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] demuxer injecting skip 1024 / discard 0
[aac @ 0x7f98a1008c00] skip 1024 / discard 0 samples due to side data
[h264 @ 0x7f98a3808800] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x7f98a3808800] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x7f98a3808800] Format yuv420p chosen by get_format().
[h264 @ 0x7f98a3808800] Reinit context to 640x368, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f98a3008200] After avformat_find_stream_info() pos: 21961 bytes read:351550 seeks:2 frames:46
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'short.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 1
 compatible_brands: isommp41mp42
 creation_time : 2020-06-10T16:12:17.000000Z
 Duration: 00:09:59.99, start: 0.000000, bitrate: 149 kb/s
 Stream #0:0(eng), 1, 1/12800: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 47 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 creation_time : 2020-06-10T16:12:17.000000Z
 handler_name : Core Media Video
 Stream #0:1(eng), 45, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 98 kb/s (default)
 Metadata:
 creation_time : 2020-06-10T16:12:17.000000Z
 handler_name : Core Media Audio
Successfully opened the file.
Parsing a group of options: output url short.wav.
Applying option ac (set number of audio channels) with argument 1.
Applying option ar (set audio sampling rate (in Hz)) with argument 16000.
Successfully parsed a group of options.
Opening an output file: short.wav.
[file @ 0x7f98a0c1db40] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
 Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[aac @ 0x7f98a100de00] skip 1024 / discard 0 samples due to side data
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
detected 12 logical cores
[graph_0_in_0_1 @ 0x7f98a0e2c4c0] Setting 'time_base' to value '1/44100'
[graph_0_in_0_1 @ 0x7f98a0e2c4c0] Setting 'sample_rate' to value '44100'
[graph_0_in_0_1 @ 0x7f98a0e2c4c0] Setting 'sample_fmt' to value 'fltp'
[graph_0_in_0_1 @ 0x7f98a0e2c4c0] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_1 @ 0x7f98a0e2c4c0] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x4
[format_out_0_0 @ 0x7f98a0e2cb80] Setting 'sample_fmts' to value 's16'
[format_out_0_0 @ 0x7f98a0e2cb80] Setting 'sample_rates' to value '16000'
[format_out_0_0 @ 0x7f98a0e2cb80] Setting 'channel_layouts' to value '0x4'
[format_out_0_0 @ 0x7f98a0e2cb80] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0x7f98a0c16ac0] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x7f98a0e2d540] [SWR @ 0x7f98a28e1000] Using fltp internally between filters
[auto_resampler_0 @ 0x7f98a0e2d540] ch:1 chl:mono fmt:fltp r:44100Hz -> ch:1 chl:mono fmt:s16 r:16000Hz
Output #0, wav, to 'short.wav':
 Metadata:
 major_brand : mp42
 minor_version : 1
 compatible_brands: isommp41mp42
 ISFT : Lavf58.20.100
 Stream #0:0(eng), 0, 1/16000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s (default)
 Metadata:
 creation_time : 2020-06-10T16:12:17.000000Z
 handler_name : Core Media Audio
 encoder : Lavc58.35.100 pcm_s16le
size= 17152kB time=00:09:16.63 bitrate= 252.4kbits/s speed=1.11e+03x 
[out_0_0 @ 0x7f98a0e2c700] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size= 18676kB time=00:09:59.99 bitrate= 255.0kbits/s speed=1.11e+03x 
video:0kB audio:18676kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000408%
Input file #0 (short.mp4):
 Input stream #0:0 (video): 1 packets read (3689 bytes); 
 Input stream #0:1 (audio): 25739 packets read (7375414 bytes); 25738 frames decoded (26355712 samples); 
 Total: 25740 packets (7379103 bytes) demuxed
Output file #0 (short.wav):
 Output stream #0:0 (audio): 25739 frames encoded (9562163 samples); 25739 packets muxed (19124326 bytes); 
 Total: 25739 packets (19124326 bytes) muxed
25738 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7f98a0c1dc40] Statistics: 4 seeks, 76 writeouts
[AVIOContext @ 0x7f98a29045c0] Statistics: 10902846 bytes read, 29 seeks



-
FFMPEG - Green cast with Splash image in video
30 mai 2020, par rossmcmI'm using FFMPEG to produce a video consisting of a single monchrome JPG image :



ffmpeg -y -loop 1 -framerate 30 -t 5 -i SplashBW.jpg Splash.mp4




There are two issues with the resulting video :



- 

- When viewed with VLC it has a green cast
- When viewed with "Film and TV" (I suspect this is the Windows 10
viewer - the association for MP4 files seems to have been hijacked
on my PC) it has a green cast and a predominant flickering every
0.5 seconds or so.







When viewed with Irfan View it looks fine. I don't know whether the issue is with the original JPG, the FFMPEG command, or the viewers. Naturally, I want it to render properly on all outputs.



The first two links below look fine in my browser (Chrome) when I open them. The third link is a screen recording of what I see when I try to play the video with the
Film and TV
app.








screen grab of video playing on my PC



A log of the FFMPEG run :



C:\Users\Raymond\Desktop\Chorus\Videos\Virtual Choir>call ffmpeg -y -loglevel verbose -loop 1 -framerate 30 -t 5 -i SplashBW.jpg Splash.mp4
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 9.2.1 (GCC) 20200122
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libope
ncore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuv
id --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
 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
[AVIOContext @ 000001e6f6ccdd00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6ccde80] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6d59b00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6ccde40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6ccdf00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6ccdfc0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cce180] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cce240] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd33c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd3480] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd3640] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd3700] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 19 times
Input #0, image2, from 'SplashBW.jpg':
 Duration: 00:00:00.03, start: 0.000000, bitrate: 38348 kb/s
 Stream #0:0: Video: mjpeg (Baseline), 1 reference frame, gray(bt470bg/unknown/unknown, center), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream mapping:
 Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 000001e6f6cd2ec0] w:1920 h:1080 pixfmt:gray tb:1/30 fr:30/1 sar:1/1 sws_param:flags=2
[libx264 @ 000001e6f6d57100] using SAR=1/1
[libx264 @ 000001e6f6d57100] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001e6f6d57100] profile High, level 4.0, 4:0:0, 8-bit
[libx264 @ 000001e6f6d57100] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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 chro
ma_me=0 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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 weigh
tb=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 'Splash.mp4':
 Metadata:
 encoder : Lavf58.29.100
 Stream #0:0: Video: h264 (libx264), 1 reference frame (avc1 / 0x31637661), gray(center), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
 Metadata:
 encoder : Lavc58.54.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[AVIOContext @ 000001e6f8b98e00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5980] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeksspeed= 0x
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks1.0kbits/s speed=0.359x
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks0.3kbits/s speed=0.828x
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks0.2kbits/s speed=1.16x
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 2 times
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5980] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
 Last message repeated 1 times
[AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
[AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
No more output streams to write to, finishing.
frame= 150 fps= 51 q=-1.0 Lsize= 142kB time=00:00:04.90 bitrate= 237.8kbits/s speed=1.65x
video:140kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.855892%
Input file #0 (SplashBW.jpg):
 Input stream #0:0 (video): 151 packets read (24127535 bytes); 151 frames decoded;
 Total: 151 packets (24127535 bytes) demuxed
Output file #0 (Splash.mp4):
 Output stream #0:0 (video): 150 frames encoded; 150 packets muxed (143004 bytes);
 Total: 150 packets (143004 bytes) muxed
[AVIOContext @ 000001e6f6d59240] Statistics: 2 seeks, 4 writeouts
[libx264 @ 000001e6f6d57100] frame I:1 Avg QP:18.13 size:131209
[libx264 @ 000001e6f6d57100] frame P:38 Avg QP:16.03 size: 87
[libx264 @ 000001e6f6d57100] frame B:111 Avg QP:24.33 size: 70
[libx264 @ 000001e6f6d57100] consecutive B-frames: 1.3% 0.0% 0.0% 98.7%
[libx264 @ 000001e6f6d57100] mb I I16..4: 1.8% 96.0% 2.2%
[libx264 @ 000001e6f6d57100] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:99.9%
[libx264 @ 000001e6f6d57100] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0% L0:21.7% L1:78.3% BI: 0.0%
[libx264 @ 000001e6f6d57100] 8x8 transform intra:96.0% inter:98.7%
[libx264 @ 000001e6f6d57100] coded y intra: 94.7% inter: 0.0%
[libx264 @ 000001e6f6d57100] i16 v,h,dc,p: 24% 37% 5% 34%
[libx264 @ 000001e6f6d57100] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 46% 22% 11% 3% 3% 3% 4% 3% 5%
[libx264 @ 000001e6f6d57100] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 79% 9% 2% 1% 2% 1% 4% 1% 1%
[libx264 @ 000001e6f6d57100] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 @ 000001e6f6d57100] Weighted P-Frames: Y:0.0%
[libx264 @ 000001e6f6d57100] ref P L0: 96.6% 0.7% 1.3% 1.3%
[libx264 @ 000001e6f6d57100] ref B L0: 96.9% 2.1% 1.0%
[libx264 @ 000001e6f6d57100] ref B L1: 94.8% 5.2%
[libx264 @ 000001e6f6d57100] kb/s:227.72
[AVIOContext @ 000001e6f6ccb880] Statistics: 32768 bytes read, 0 seeks



-
Use ff mpeg inside a loop to create thumbnails
30 avril 2014, par Paul LedgerI have an uploader which I am creating for a site. The uploader is a jquery plugin which I am on creating that allows single of multiple uploads of images or videos.
The uploader works with no problems and ffmpeg does create thumbnails no problem. However I have a max file size of 1GB which I will implement to the total of uploads so that users cannot upload to much in one go. But for testing I haven’t yet so I can test the limits of the uploader capabilities before adding restrictions.
I have 4 videos I am using to test 246mb each. The files upload and move to the folder set on the test server (localhost) but the thumbnails don’t create as the PHP script extends the maximum time limit. The easy option would be to change this in php.ini easily.
The problem is thought the progress bar only tracks the upload not the ffmpeg conversion. Is there a way of tracking this in my progress bar or running this as a background task with multiple video files.
It might be worth mentioning but with smaller videos, under 70mb each there is no problem at all thumbnails are created but still after the progress bar reaches 100%.
If it helps heres the relevant sections of the code. I can add the full source on git if needed. But I do fear that the answer will be no or alter the php.ini file
JQuery/ Ajax :
$.ajax({
url: options.processor,
type: "POST",
data: formdata,
processData: false,
contentType: false,
dataType:"JSON",
beforeSend: init,
error: error,
xhr: function() {
var myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress',uploadProgress, false);
}
return myXhr;
},
success: onComplete
});
var uploadProgress = function(e){
if(e.lengthComputable){
if(options.single === true){
$('#'+options.counter).html('File 1 of 1');
}else{
$('#'+options.counter).html('Files '+ item_count +' of ' + item_count + ' uploading');
}
var p = (e.loaded / e.total) * 100;
$('#'+options.progress_text).html(Math.round(p) + '%');
$('#'+options.progress_bar).width(p + '%');
}
}PHP :
if(!empty($_FILES['file'])){
if(!empty($_POST['single'])){
//single file upload
if($_FILES['file']['error'] === 0){
$temp = $_FILES['file']['tmp_name'];
$name = $_FILES['file']['name'];
$ext = explode('.',$name);
$ext = strtolower(end($ext));
$file = md5($temp).time().'.'.$ext;
if(in_array($ext,$allowed) === true && move_uploaded_file($temp,"../uploads/{$file}") === true){
$succedeed[] = array('name' => $name,'file' => $file,'type'=>'image');
}else{
$failed[] = array('name' => $name, 'file' => $file, 'error' => 'File type not allowed');
}
}
}else{
//multiple file upload
foreach($_FILES['file']['name'] as $key => $name){
if($_FILES['file']['error'][$key] === 0){
$temp = $_FILES['file']['tmp_name'][$key];
$ext = explode('.',$name);
$ext = strtolower(end($ext));
$_file = md5($temp).time();
$file = $_file.'.'.$ext;
if(in_array($ext,$allowed) === true && move_uploaded_file($temp,"../uploads/{$file}") === true){
$file_type = explode('/',$_FILES['file']['type'][$key]);
if($file_type[0] === 'image'){
echo 'image';
$succedeed[] = array('name' => $name,'file' => $file, 'type' => 'image');
}else{
$ffmpeg = 'ffmpeg';
$output = dirname(__DIR__).'/uploads/thumbs/'.$_file.'.jpg';
$input = dirname(__DIR__).'/uploads/'.$file;
$mov = new ffmpeg_movie($input);
$d = $mov->getDuration();
$iscopy = $mov->getCopyright();
$h = $mov->getFrameHeight();
$w = $mov->getFrameWidth();
$pos = ceil((int)$d /3);
$size = $w.'x'.$h;
$cmd = "ffmpeg -i $input -an -ss $pos -s $size $output";
shell_exec($cmd);
$succedeed[] = array('name' => $name,'file' => '/thumbs/'.$_file.'.jpg', 'type' => 'video');
}
}else{
$failed[] = array('name' => $name, 'file' => $file, 'error' => 'File type not allowed');
}
}
}
}
}**UPDATE the process of converting the files to thumbnails takes less time if I drop the posotion of where the thumb is taken from ie :
$cmd = "ffmpeg -i $input -an -ss $pos -s $size $output";
would become
$cmd = "ffmpeg -i $input -an -ss 3 -s $size $output";
I presume this is because ffmpeg plays the video until it gets to that point in the video to take the thumbnail. There for if the video is 5mins and the the thumb is taken at 2.30 then each conversion would take 2 min 30. I think I answered my own question here but take the thumbnail form somewhere between 1 - 5 seconds. Or alternately add a second progress bar into the onComplete handler which would calculate the time this would take and display it to the user.