
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (62)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (8210)
-
FFMPEG Take 1 second clips each video file from a directory of files, and until total playtime reached
3 février 2021, par MatthewI'm working on a music art video project for a song.


I have a directory that contains approximately 400 individual videos


- 

- varying lengths (as short as 3 seconds and as long as 31 minutes)
- varying file types (mp4 and webm)
- varying resolutions/framerates/bitrates








The output video should consist of :


- 

- 1 second chunks of each video
- in round-robin fashion
- until all videos are played fully or the output total video length reaches a certain limit (example, 20 minutes).
- Output video should be 1280×720 at 24fps, with no preference to bitrate.
- Videos that are larger should be scaled down and letterboxed (vertically or horizontally).
- Audio is not important at all. The video can be silent. I can overlay audio separately.














I do not want to loop short videos. In the example below, you can see that, for
top-left-view-take-1.mp4
, each 'clip' that's taken is incrementally further into the video. In other words, it shouldn't take the same 1 second clip from the beginning. The goal is to get further in to each individual video as the output video progresses.

For example, say my directory contains files such as the following (and, for the example here, we'll say that this is all files in the directory) :


overhead-view-take-1.mp4 (3 seconds, for the sake of the question)
top-right-view-take-1.mp4 (3 seconds, for the sake of the question)
top-right-view-take-2.mp4 (5 seconds, for the sake of the question)
outside-kaleidoscope-1.mp4
yellow-kaleidoscope-1.mp4
red-kaleidoscope-1.mp4
brake-lights-slow-1.mp4
soft-city-lights.webm



Assume anything that isn't marked with a video duration is at least 5 seconds long.


Based on the above files & times, here would be the order and time code of each clip during the first 30 seconds of the output video :


Based on each video's total duration, the output video should include 1 second clips from all videos in the directory.







 Output time 

Clip time 

Clip file 







 00:00-00:01 

00:00-00:01 

overhead-view-take-1.mp4 




 00:01-00:02 

00:00-00:01 

top-right-view-take-1.mp4 




 00:02-00:03 

00:00-00:01 

top-right-view-take-2.mp4 




 00:03-00:04 

00:00-00:01 

outside-kaleidoscope-1.mp4 




 00:04-00:05 

00:00-00:01 

yellow-kaleidoscope-1.mp4 




 00:05-00:06 

00:00-00:01 

red-kaleidoscope-1.mp4 




 00:06-00:07 

00:00-00:01 

brake-lights-slow-1.mp4 




 00:07-00:08 

00:00-00:01 

soft-city-lights.webm 




 00:08-00:09 

00:01-00:02 

overhead-view-take-1.mp4 




 00:09-00:10 

00:01-00:02 

top-right-view-take-1.mp4 




 00:10-00:11 

00:01-00:02 

top-right-view-take-2.mp4 




 00:11-00:12 

00:01-00:02 

outside-kaleidoscope-1.mp4 




 00:12-00:13 

00:01-00:02 

yellow-kaleidoscope-1.mp4 




 00:13-00:14 

00:01-00:02 

red-kaleidoscope-1.mp4 




 00:14-00:15 

00:01-00:02 

brake-lights-slow-1.mp4 




 00:15-00:16 

00:01-00:02 

soft-city-lights.webm 




 00:16-00:17 

00:02-00:03 

overhead-view-take-1.mp4 




 00:17-00:18 

00:02-00:03 

top-right-view-take-1.mp4 




 00:18-00:19 

00:02-00:03 

top-right-view-take-2.mp4 




 00:19-00:20 

00:02-00:03 

outside-kaleidoscope-1.mp4 




 00:20-00:21 

00:02-00:03 

yellow-kaleidoscope-1.mp4 




 00:21-00:22 

00:02-00:03 

red-kaleidoscope-1.mp4 




 00:22-00:23 

00:02-00:03 

brake-lights-slow-1.mp4 




 00:23-00:24 

00:02-00:03 

soft-city-lights.webm 









Now, the output video should include 1 second clips only from videos that still have time remaining. The videos that don't have any time remaining, such as
overhead-view-take-1.mp4
andtop-right-view-take-1.mp4
, are not present here.






 Output time 

Clip time 

Clip file 







 00:24-00:25 

00:03-00:04 

top-right-view-take-2.mp4 




 00:25-00:26 

00:03-00:04 

outside-kaleidoscope-1.mp4 




 00:26-00:27 

00:03-00:04 

yellow-kaleidoscope-1.mp4 




 00:27-00:28 

00:03-00:04 

red-kaleidoscope-1.mp4 




 00:28-00:29 

00:03-00:04 

brake-lights-slow-1.mp4 




 00:29-00:30 

00:03-00:04 

soft-city-lights.webm 









What I've tried


- 

- I've read through the docs and cobbled together some code that produces output, but it only seems to work with images ; I can't get the same thing to work with videos (specifically the incremental chunks).
- I've tried manipulating commands meant to `create a snapshot every x seconds/frames' but I've hit dead ends there.
- I've also started trying to create a text file to run the input from. That's the point where I thought it would make sense to ask here.








My main issue is picking off incremental chunks of individual videos, and playing those in sequence.


Thoughts ?


Environment details
I have access to Win, Mac, and Linux machines. So, that environment isn't as important to me. Here's ffmpeg's output :


ffmpeg version 4.3.1-0york0~16.04 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
 configuration: --prefix=/usr --extra-version='0york0~16.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
Hyper fast Audio and Video encoder



-
ffmpeg creating multiple output videos, splitting on gt(scene,x)
2 janvier 2021, par spitfire109I want to split one video up into multiple parts based on detecting the first frame of each shot, by select scene in ffmpeg.



The following entry records the scene frames and creates a photo mosaic out of them. This indicates to me that the select portion is functional, but I want to use this to create many separate videos, each scene it's own video file.



ffmpeg -i video.mpg -vf select='gt(scene\,0.2331)','scale=320x240,tile=1x100' -frames:v preview.png




Thank you. I think I am close, and I am open to any solution.


-
Invalid data stream in media could not be discarded by FFMPEG. Why is it staying and how to discard it ?
5 décembre 2020, par Link-akroI have downloaded a [short media][1] i intend to convert then i will use the result as basis to practice and test any and all FFMPEG commands i learn or use later.


That video seems to have an unknown invalid stream which never disappears no matter everything i tried to discard it. When i try to work with it later i get various problems like missing codec or no stream which is not the focus here but the reason why i got stubborn to remove the things i cannot deal with.


The following probing prints a warning in yellow color on last row.


> ffprobe -hide_banner -show_streams Movie_Countdown-youtube_I1vMKZ1kvg0.mov

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Movie_Countdown-youtube_I1vMKZ1kvg0.mov':
 Metadata:
 major_brand : qt
 minor_version : 537199360
 compatible_brands: qt
 creation_time : 2015-05-20T13:45:55.000000Z
 Duration: 00:00:10.00, start: 0.000000, bitrate: 11474 kb/s
 Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9930 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
 Metadata:
 creation_time : 2015-05-20T13:45:55.000000Z
 handler_name : Apple Video Media Handler
 encoder : H.264
 timecode : 00:00:00:00
 Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
 Metadata:
 creation_time : 2015-05-20T13:45:56.000000Z
 handler_name : Apple Sound Media Handler
 timecode : 00:00:00:00
 Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
 Metadata:
 creation_time : 2015-05-20T13:46:11.000000Z
 handler_name : Time Code Media Handler
 timecode : 00:00:00:00
Unsupported codec with id 0 for input stream 2



Below the streams output. I split the text so you see the warning without searching in the middle.


[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=Main
codec_type=video
codec_time_base=1/50
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
coded_width=1920
coded_height=1088
closed_captions=0
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=40
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/25
start_pts=0
start_time=0.000000
duration_ts=250
duration=10.000000
bit_rate=9930739
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=250
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2015-05-20T13:45:55.000000Z
TAG:language=eng
TAG:handler_name=Apple Video Media Handler
TAG:encoder=H.264
TAG:timecode=00:00:00:00
[/STREAM]
[STREAM]
index=1
codec_name=pcm_s16le
codec_long_name=PCM signed 16-bit little-endian
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=sowt
codec_tag=0x74776f73
sample_fmt=s16
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=16
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=480000
duration=10.000000
bit_rate=1536000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=480000
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2015-05-20T13:45:56.000000Z
TAG:language=eng
TAG:handler_name=Apple Sound Media Handler
TAG:timecode=00:00:00:00
[/STREAM]
[STREAM]
index=2
codec_name=unknown
codec_long_name=unknown
profile=unknown
codec_type=data
codec_tag_string=tmcd
codec_tag=0x64636d74
id=N/A
r_frame_rate=0/0
avg_frame_rate=25/1
time_base=1/25
start_pts=0
start_time=0.000000
duration_ts=250
duration=10.000000
bit_rate=3
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2015-05-20T13:46:11.000000Z
TAG:language=eng
TAG:handler_name=Time Code Media Handler
TAG:timecode=00:00:00:00
[/STREAM]



I scaled it down and recoded it for starters and i tried to discard the data stream with
-dn
and failed other methods i will mention at the end.
The output so far suggests that discarding should have worked since alternative datas are 0kB and no stream 2 is listed.

> ffmpeg -hide_banner -dn -i C:\Users\admin-dix\Downloads\Movie_Countdown-youtube_I1vMKZ1kvg0.mov -vf "scale=h=450:w=800" -f mp4 -c:a aac -c:v libx264 mov_countdown.mp4

Output #0, mp4, to 'mov_countdown.mp4':
 Metadata:
 major_brand : qt
 minor_version : 537199360
 compatible_brands: qt
 encoder : Lavf58.45.100
 Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 800x450 [SAR 1:1 DAR 16:9], q=-1--1, 0.04 fps, 12800 tbn, 25 tbc (default)
 Metadata:
 creation_time : 2015-05-20T13:45:55.000000Z
 handler_name : Apple Video Media Handler
 timecode : 00:00:00:00
 encoder : Lavc58.91.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 creation_time : 2015-05-20T13:45:56.000000Z
 handler_name : Apple Sound Media Handler
 timecode : 00:00:00:00
 encoder : Lavc58.91.100 aac
frame= 250 fps= 43 q=-1.0 Lsize= 342kB time=00:00:10.00 bitrate= 280.1kbits/s speed= 1.7x
video:175kB audio:159kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.710857%



Then ffprobe disagrees, there is still the stream and the warning.


ffprobe mov_countdown.mp4

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mov_countdown.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.45.100
 Duration: 00:00:10.02, start: 0.000000, bitrate: 279 kb/s
 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x450 [SAR 1:1 DAR 16:9], 142 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 handler_name : Apple Video Media Handler
 timecode : 00:00:00:00
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
 Metadata:
 handler_name : Apple Sound Media Handler
 Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
 Metadata:
 handler_name : Apple Video Media Handler
 timecode : 00:00:00:00
Unsupported codec with id 0 for input stream 2



I tried negative mapping as per this answer
-map 0:d
which failed. I did not understand-discard
option as ffmpeg documentation refers to from the-vn
,-an
,-dn
entries as it does not specify a stream.

Why does it do that and how can i remove that stream i do not know and do not want to care about in future tests ?


[1] : Clean Retro Movie Countdown - YouTube from Philippe Moesch https://www.youtube.com/watch?v=I1vMKZ1kvg0