
Recherche avancée
Autres articles (112)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (6212)
-
Script to cut video by silence part with FFMPEG
11 février 2020, par fricadelleThis is a question that is raised here How to split video or audio by silent parts or here How can I split an mp4 video with ffmpeg every time the volume is zero ?
So I was able to come up with a straightforward bash script that works on my Mac.
Here it is (only argument is the name of the video to be cut, it will generate a file start_timestamps.txt with the list of silence starts if the file does not exist and reuse it otherwise) :
#!/bin/bash
INPUT=$1
filename=$(basename -- "$INPUT")
extension="${filename##*.}"
filename="${filename%.*}"
SILENCE_DETECT="silence_detect_logs.txt"
TIMESTAMPS="start_timestamps.txt"
if [ ! -f $TIMESTAMPS ]; then
echo "Probing start timestamps"
ffmpeg -i "$INPUT" -af "silencedetect=n=-50dB:d=3" -f null - 2> "$SILENCE_DETECT"
cat "$SILENCE_DETECT"| grep "silence_start: [0-9.]*" -o| grep -E '[0-9]+(?:\.[0-9]*)?' -o > "$TIMESTAMPS"
fi
PREV=0.0
number=0
cat "$TIMESTAMPS"| ( while read ts
do
printf -v fname -- "$filename-%02d.$extension" "$(( ++number ))"
DURATION=$( bc <<< "$ts - $PREV")
ffmpeg -y -ss "$PREV" -i "$INPUT" -t "$DURATION" -c copy "$fname"
PREV=$ts
done
printf -v fname -- "$filename-%02d.$extension" "$(( ++number ))"
ffmpeg -y -ss "$PREV" -i "$INPUT" -c copy "$fname" )Unfortunately it does not seem to work :
I have a video that is basically a collection of clips, each clip being introduced by a 5 second silence with a static frame with a title on it. So I want to cut the original video so that each chunk is the 5 seconds "introduction" + video until the next introduction. Hope it’s clear.
Anyway, in my script I first find all silence_start using ffmpeg silencedetect plugin. I get a start_timestamps.txt that read :
141.126
350.107
1016.07
etc.Then for example I would call (I don’t need to transcode again the video), knowing that (1016.07 - 350.107) = 665.963
ffmpeg -ss 350.107 -i Some_video.mp4 -t 665.963 -c copy "Some_video02.mp4"
The edge cases being the first chunk that has to go from 0 to 141.126 and the last chunk that has to go from last timestamp to end of the video.
Anyway the start_timestamps seem legit. But my output chunks are completely wrong. Sometimes the video does not even play anymore in Quicktime. I don’t even have my static frame with the title in any of the videos...
Hope someone can help. Thanks.
EDIT Ok as explained in the comments, if I echo $PREV while commenting out the ffmpeg command I get a perfectly legit list of values :
0.0
141.126
350.107
1016.07
etc.With the ffmpeg command I get :
0.0
141.126
50.107
016.07
etc.bash variable changes in loop with ffmpeg shows why.
I just need to append < /dev/null to the ffmpeg command or add -nostdin argument. Thanks everybody.
-
Haskell - Turning multiple image-files into one video-file using the ffmpeg-light package
25 avril 2021, par oRoleBackground

I wrote an application for image-processing which uses theffmpeg-light
package to fetch all the frames of a given video-file so that the program afterwards is able to apply grayscaling, as well as edge detection alogrithms to each of the frames.

Now I'm trying to put all of the frames back into a single video-file.


Used Libs

ffmpeg-light-0.12.0

JuicyPixels-3.2.8.3

...

What have I tried ?

I have to be honest, I didn't really try anything because I'm kinda clueless where and how to start. I saw that there is a package calledCommand
which allows running processes/commands using the command line. With that I could use ffmpeg (notffmpeg-light
) to create a video out of image-files which I would have to save to the hard drive first but that would be kinda hacky.
Within the documentation of
ffmpeg-light
on hackage (ffmpeg-light docu) I found the frameWriter function which sounds promising.

frameWriter :: EncodingParams -> FilePath -> IO (Maybe (AVPixelFormat, V2 CInt, Vector CUChar) -> IO ()) 



I guess
FilePath
would be the location where the video file gets stored but I can't really imagine how to apply the frames asEncodingParams
to this function.

Others

I can access :

- 

r
,g
,b
,a
as well asy
.a
values- image width / height / format






Question

Is there a way to achieve this using theffmpeg-light
package ?

As the
ffmpeg-light
package lacks of documentation when it comes to conversion from images to video, I really would appreciate your help. (I do not expect a fully working solution.)

Code

The code that reads the frames :

-- Gets and returns all frames that a given video contains
getAllFrames :: String -> IO [(Double, DynamicImage)]
getAllFrames vidPath = do 
 result <- try (imageReaderTime $ File vidPath) :: IO (Either SomeException (IO (Maybe (Image PixelRGB8, Double)), IO()))
 case result of 
 Left ex -> do 
 printStatus "Invalid video-path or invalid video-format detected." "Video" 
 return []
 Right (getFrame, _) -> addNextFrame getFrame [] 

-- Adds up all available frames to a video.
addNextFrame :: IO (Maybe (Image PixelRGB8, Double)) -> [(Double, DynamicImage)] -> IO [(Double, DynamicImage)]
addNextFrame getFrame frames = do
 frame <- getFrame
 case frame of 
 Nothing -> do 
 printStatus "No more frames found." "Video"
 return frames
 _ -> do 
 newFrameData <- fmap ImageRGB8 . swap . fromJust <$> getFrame 
 printStatus ("Frame: " ++ (show $ length frames) ++ " added.") "Video"
 addNextFrame getFrame (frames ++ [newFrameData]) 



Where I am stuck / The code that should convert images to video :


-- Converts from several images to video
juicyToFFmpeg :: [Image PixelYA8] -> ?
juicyToFFmpeg imgs = undefined



-
How to take screenshots of streamers using the Twitch API
10 décembre 2020, par oo92My goal is to create a dataset of gameplays on Twitch using the API. How I want to do it is this :


- 

- Get a list of live streams using the API.
- Use streamlink and ffmpeg on Python to take the screenshots through the Stream source






To get the streams, I have the following code thanks to a SO user :


from twitch import TwitchClient

client = TwitchClient(client_id='<my client="client">')
streams = client.streams.get_live_streams(limit=100)

print(streams)
</my>


The output is this. Its a lot larger, I just made it shorter... :


[{'id': 40889579422, 'game': 'Among Us', 'broadcast_platform': 'live', 'community_id': '', 'community_ids': [], 'viewers': 74594, 'video_height': 1080, 'average_fps': 60, 'delay': 0, 'created_at': datetime.datetime(2020, 12, 9, 23, 53, 34), 'is_playlist': False, 'stream_type': 'live', 'preview': {'small': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-80x45.jpg', 'medium': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-320x180.jpg', 'large': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-640x360.jpg', 'template': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-{width}x{height}.jpg'}, 'channel': {'mature': False, 'status': 'amongus at 4 !!', 'broadcaster_language': 'en', 'broadcaster_software': '', 'display_name': 'Sykkuno', 'game': 'Among Us', 'language': 'en', 'id': 26154978, 'name': 'sykkuno', 'created_at': datetime.datetime(2011, 11, 15, 1, 29, 29, 140794), 'updated_at': datetime.datetime(2020, 12, 10, 0, 35, 50, 916363), 'partner': True, 'logo': 'https://static-cdn.jtvnw.net/jtv_user_pictures/sykkuno-profile_image-6ab1e70e07e29e9b-300x300.jpeg', 'video_banner': 'https://static-cdn.jtvnw.net/jtv_user_pictures/4b654ce5-58dc-4fa6-b77c-7250bb2d5269-channel_offline_image-1920x1080.png', 'profile_banner': 'https://static-cdn.jtvnw.net/jtv_user_pictures/1caee146-3323-4d45-9907-96c20c224d3e-profile_banner-480.png', 'profile_banner_background_color': '', 'url': 'https://www.twitch.tv/sykkuno', 'views': 23590965, 'followers': 1928724, 'broadcaster_type': '', 'description': 'Hi ! ', 'private_video': False, 'privacy_options_enabled': False}}, ... 



First, I want to know how I can iterate through the JSON to get the channel name using the
id
. I tried to do it on my own but it said that it isn't subscriptable.

Second, I have the following code that tries to use
ffmpeg
to get a screenshot of the stream through its source :

import streamlink, os

# This code connects to the streamer's source
# Get the Twitch API to work so you can add the streamer's name at the end of the link
username = 'Sykkuno'
streams = streamlink.streams('http://twitch.tv/' + username)

# Stream source
stream = streams["best"].url

# Directory where the screenshots will be saved
dir_path = os.getcwd() + '/' + username

# number of streamers
streamers = 1

os.system('ffmpeg -i ' + stream +' -r 0.5 -f image2 ${dir}/output_%09d.jpg')



But that is throwing the following error :


ffmpeg version 4.1.3-0ppa1~18.04 Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
 configuration: --prefix=/usr --extra-version='0ppa1~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-avisynth --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 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
[hls,applehttp @ 0x557212854940] Opening 'https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuAErHgNDEVK3cqjkRZLcz4El99YD2ZSy9tgtjc3ZTrPuN4584-GY3DKYO3MFCBt9M3v8_7IfHAlLvHeUn2wq4d-VC7u4Zv2-k1Bee9IPmIXbFQLZFKrYiT98OTzFMDaElsEZ9Sr4MXz6FoAC1yXhhZ0MYahZVnZa1Tuqnn217nN_rN8wr7kdScBIir_Uo1s2C_I8_54mi2uzdgxB9AYj0a0kG2UtdPkUVA6Qc7XIZ0nUhEeObEf80N0uW9ZU6WHpO3V6G9RD0VkmwUexDWk9MaLy1NJuvLSzRaMfOmKxhrzn3UDoY4CrQN11KOnHYCiCOfvhZmMKzSqtiA8YP0Q9iS03eZZhPQ3WxBHWhd6VeZ0btNeeoudGX73EBIj4ujZnKWKfPiN8K_HLj5FZWqQ5m_4Q1llQlnSAfmhzXR9PHAkz8nxRVcFR-tFokGzFEfkZGHngPNz9boLmo4KHx6404rocPUcXbTHkYsWXZwFC356AhfrNn6x0JYHGfcDpRsEFebLQljEpCyhnNOHFEf9b7Ipeiy521cCupzoEz1uMrzW77h9FJwn0GwvY3jp2KwRXJMvArYwiUHccBmfW7ZDLO9vH7eJGUnAzoy586KMSPLVeLxWMWRDfKkAcI8vYXOIuxNb_MZKm2O_dcoFrDDta5TZn-MLjFquT47P9NbXxlTTJfimlYyMG17SPoW3KJVtAJmjoj0GZ1ehftLJWz1Qgd8zmg40u4g8fz867eCHW_Tiv65yd6qJZD-_bD3G916fm3KeA9bPyhalTD99CWhQL7f0apCfX_6IiQElgPT6kOrFI-ISEG4GdhIpFi4ubzSx29pm7H4aDIXx6BAI5ziHVMPbrg.ts' for reading
[hls,applehttp @ 0x557212854940] Opening 'https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuIECWLarz2I5hNCtGLSTDXbCIgahI91KOHXVmPHddzZediyiVbcicZpGakO99CJp1cK_6OnmOKBzZ3sn3KogNyPVRqSy32IpanlyPPUTz23TojfR5DTmJa3zampOzVMfETvvPEpj58-kGhQeQQGtK1zLV2h465RElCLkmc7SeWbXEZ5j6IQ38OVFZ0vdcMHVTNPtJaY7509bE196-9-5YYFiET_-kdkS2X6_lhVQBZrq45PBxApTzeLkDx9ZtGQx78dLr_tZepww_uVnJTwxI_TA3tU8z5_w8ml6rh0GK1W6lTlvuDkPKAwIDLvG736MtbPGz9cFPoRAFQxD3QSwAM-bO1grvWlNsOUDUYLXLNjuejmz8xmRpeE0pqJYxUboRZpxrPXTi52HcX8lpGT4Lx2z6hJcoi9npQttK58HDSHQ3cYH3rlNsYV_RlZ3F-u-fZSn8Em67-vAYeXAMaBe9xxv0Zu2n1TrdPICMyGmk-VgLK788IeDhxqM441GONGLxo6AF8RE5_OawTf9n_MVzImsX4LMn0oN8e8w6mjk7YDuNdA4mEl99Erg8xMdX6Q3fDYTdStaC-zQwXgMctfGpIsUpp91BtRBPMynFCxZ8fZB7NvGFNZTYWDvCZjisiwzs0N1pDdDM_Fkj3i46_Ou105z348PLHRA28Dt1qgn_NjzwRNoaowFx7PxQ-X2zRpAhwNcqaTOHYh5NYZHToVE16WiOe9HzVs_I_3Wqu44bypEsGrhxYhgXSGfvO757iTbErZHmkidsBF2BET5j3JeIifr4fJooalAKc_5uiSPMCGSTtV9hIQX5mQWJudg9UsMRp1AWVrnBoMQPAhy1UwBDtAOrBs.ts' for reading
Input #0, hls,applehttp, from 'https://video-weaver.yto01.hls.ttvnw.net/v1/playlist/CvADco9ZO_szpL7RVLVI3U6zl4IMo2uaUBvZTWAyEOKETN-SxI3m3hLLxpmCfz06rlyCGCPimEbk28kKPSbVYtMThiZFRtLxnrdpLr5DWBQwbpIStPQwMetU4Z04Mkm3nEWplL8hpn69Cmd_eWSdI1yHubK_sRL-n1ml5akAEWWGkS0OgVRQTTsYv4RpkbeWc8wrr3DsDBDfyrxciGSZevnStZOLwg-tNuNu3VNugLigNG1HMsNdxoJGO6wLyO-6FL5EQidOiSw2THSibAvADAWMVOxNX2z39d-nJwbVprbWFnox_lDlh-y88uhjj_MpU6OwkXP9vgrBDEmKjtRbYsIN5N94-8pDFEB3yIYk10vUiuod1yfqztVCqWo5m9r48uINP1CD-Bwgybo6K7Oko-TUjMj43GqAu0mmPtkgPFO69LpQQMifZTn_XbVQ5UUfoCwyl-ljObfRE51aCvZP_dOTsUyqi_JRE8h-C3306aW1ISXwCs3YpnjDxJv6yKyWTktBvsN5NWMVzJg-_-MAtTmoy-w2ppbbOozLzyrGF4zfCetaHLmHtbsKe1Ed1nndJg9b6T7v-87ExrI0eQwRjH3gmBTgqu_peS5oQGBaDOe4QSGMNFgf8lQfuqvFH-miXgpk8RytdorzT7wB05iX7c3bhBIQ3FvvjNIal3IgvyxKatZs4BoMW_P_CuyZOUJs2_Yr.m3u8':
 Duration: N/A, start: 60.000000, bitrate: N/A
 Program 0 
 Metadata:
 variant_bitrate : 0
 Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
 Metadata:
 variant_bitrate : 0
 Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, unknown/bt709/unknown), 1920x1080, 29.97 tbr, 90k tbn, 2k tbc
 Metadata:
 variant_bitrate : 0
 Stream #0:2: Data: timed_id3 (ID3 / 0x20334449)
 Metadata:
 variant_bitrate : 0
Stream mapping:
 Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x557213e262c0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/output_%09d.jpg':
 Metadata:
 encoder : Lavf58.20.100
 Stream #0:0: Video: mjpeg, yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 0.50 fps, 0.50 tbn, 0.50 tbc
 Metadata:
 variant_bitrate : 0
 encoder : Lavc58.35.100 mjpeg
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[image2 @ 0x557213012040] Could not open file : /output_000000001.jpg
av_interleaved_write_frame(): Input/output error
frame= 1 fps=0.0 q=7.5 Lsize=N/A time=00:00:02.00 bitrate=N/A speed=27.7x 
video:46kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!