
Recherche avancée
Autres articles (3)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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 (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (3244)
-
Python script doesn't work properly when ran through terminal, but works fine in Jupyter and Visual Studio
21 octobre 2018, par Ivan NovikovI have a script to extract the audio from all video files in a folder.
The folder with videos is located at : /Users/MyName/Downloads/Video_Audio_files
When I try to run it through terminal and I’m prompted for the folder path
folder = input("Path to folder:")
, I drag and drop it there (which is how I got the above path), but the script doesn’t seem to be working (stuck at 0 out of 7 and no output files).When I input exactly the same path when prompted in Jupyter Notebook or in Visual Studio it works perfectly !
Edit : I think I have found the issue, when I drag and drop the folder, there is an extra space (’Downloads/folder ’ instead of ’Downloads/folder’).
pbar = ProgressBar()
files = []
extensions = []
folder = input("Path to folder:")
#folder = 'Video_Audio_files'
pathlist = Path(folder).glob('**/*.mp4')
for path in pathlist:
path_in_str = str(path)
name = path_in_str.split("/")[1]
files.append(path_in_str.split(".")[0])
extensions.append(path_in_str.split(".")[1])
os.system('cd ' + folder)
for i in pbar(range(len(files))):
video_format = extensions[i]
video_name = files[i]
output_format = 'flac'
output_name = video_name + '_audio'
bashCommand = 'ffmpeg -i ' + video_name + '.' + video_format + ' -f ' + output_format + ' -ab 192000 -vn ' + output_name + '.' + output_format
#should be of this format: bashCommand = 'ffmpeg -i Video.mp4 -f flac -ab 192000 -vn ExtractedAudio.flac'
os.system(bashCommand) -
ffmpeg error in subprocess.run but works in terminal
6 juin 2023, par 8TMI'm creating my own MKV videos and I found a strange bug when I'm using subprocess module from python 3.11.2 to execute FFmpeg command.


My FFmpeg command is running fine in terminal (ends with success) :


ffmpeg -y \
-i input_video_stream.mkv \
-i input_audio_stream_1.ac3 \
-i input_audio_stream_2.ac3 \
-i input_audio_stream_3.ac3 \
-i input_audio_stream_4.ac3 \
-f srt -i input_subtitle_stream_1.srt \
-f srt -i input_subtitle_stream_2.srt \
-map 0 -map 1 -map 2 -map 3 -map 4 -map 5 -map 6 \
-c copy \
-metadata:s:a:0 language=eng -metadata:s:a:0 title="English1" \
-metadata:s:a:1 language=eng -metadata:s:a:1 title="English2" \
-metadata:s:a:2 language=eng -metadata:s:a:2 title="English3" \
-metadata:s:a:3 language=eng -metadata:s:a:3 title="English4" \
-metadata:s:s:0 language=eng -metadata:s:s:0 title="English1" -metadata:s:s:0 mimetype=application/x-ass \
-metadata:s:s:1 language=eng -metadata:s:s:1 title="English2" -metadata:s:s:1 mimetype=application/x-ass \
-disposition:a:0 default -disposition:s:s:0 default \
output_video_with_audio_and_subtitles.mkv



But when I'm running it by in the same terminal (the same session and the same ffmpeg version) by python from subprocess.run(command) :


subprocess.run([
 'ffmpeg', '-y',
 '-i', 'input_video_stream.mkv',
 '-i', 'input_audio_stream_1.ac3',
 '-i', 'input_audio_stream_2.ac3',
 '-i', 'input_audio_stream_3.ac3',
 '-i', 'input_audio_stream_4.ac3',
 '-f', 'srt', '-i', 'input_subtitle_stream_1.srt',
 '-f', 'srt', '-i', 'input_subtitle_stream_2.srt',
 '-map', '0', '-map', '1', '-map', '2', '-map', '3', '-map', '4', '-map', '5', '-map', '6',
 '-c', 'copy',
 '-metadata:s:a:0', 'language=eng', '-metadata:s:a:0', 'title="English1"', 
 '-metadata:s:a:1', 'language=eng', '-metadata:s:a:1', 'title="English2"', 
 '-metadata:s:a:2', 'language=eng', '-metadata:s:a:2', 'title="English3"', 
 '-metadata:s:a:3', 'language=eng', '-metadata:s:a:3', 'title="English4"', 
 '-metadata:s:s:0', 'language=eng', '-metadata:s:s:0', 'title="English1"', 
 '-metadata:s:s:0', 'mimetype=application/x-ass',
 '-metadata:s:s:1', 'language=eng', '-metadata:s:s:1', 'title="English2"', '-metadata:s:s:1', 'mimetype=application/x-ass', 
 '-disposition:a:0 default', '-disposition:s:s:0 default', 
 'output_video_with_audio_and_subtitles.mkv'
])




it fails :



ffmpeg version 5.1.2-3 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12 (Debian 12.2.0-14)
 configuration : —prefix=/usr —extra-version=3 —toolchain=hardened —libdir=/usr/lib/x86_64-linux-gnu —incdir=/usr/include/x86_64-linux-gnu —arch=amd64 —enable-gpl —disable-stripping —enable-gnutls —enable-ladspa —enable-libaom —enable-libass —enable-libbluray —enable-libbs2b —enable-libcaca —enable-libcdio —enable-libcodec2 —enable-libdav1d —enable-libflite —enable-libfontconfig —enable-libfreetype —enable-libfribidi —enable-libglslang —enable-libgme —enable-libgsm —enable-libjack —enable-libmp3lame —enable-libmysofa —enable-libopenjpeg —enable-libopenmpt —enable-libopus —enable-libpulse —enable-librabbitmq —enable-librist —enable-librubberband —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libspeex —enable-libsrt —enable-libssh —enable-libsvtav1 —enable-libtheora —enable-libtwolame —enable-libvidstab —enable-libvorbis —enable-libvpx —enable-libwebp —enable-libx265 —enable-libxml2 —enable-libxvid —enable-libzimg —enable-libzmq —enable-libzvbi —enable-lv2 —enable-omx —enable-openal —enable-opencl —enable-opengl —enable-sdl2 —disable-sndio —enable-libjxl —enable-pocketsphinx —enable-librsvg —enable-libmfx —enable-libdc1394 —enable-libdrm —enable-libiec61883 —enable-chromaprint —enable-frei0r —enable-libx264 —enable-libplacebo —enable-librav1e —enable-shared
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, matroska,webm, from 'input_video_stream.mkv' :
 Metadata :
 ENCODER : Lavf59.27.100
 Duration : 00:44:19.94, start : 0.000000, bitrate : 22551 kb/s
 Stream #0:0 : Video : h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
 Metadata :
 BPS : 22549589
 NUMBER_OF_FRAMES : 63631
 NUMBER_OF_BYTES : 7480665638
 _STATISTICS_WRITING_APP : mkvmerge v56.0.0 ('Strasbourg / St. Denis') 64-bit
 _STATISTICS_WRITING_DATE_UTC : 2023-05-15 08:21:43
 _STATISTICS_TAGS : BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
 DURATION : 00:44:19.942000000
[ac3 @ 0x55b374ee9e80] Estimating duration from bitrate, this may be inaccurate
Input #1, ac3, from 'input_audio_stream_1.ac3' :
 Duration : 00:44:19.89, start : 0.000000, bitrate : 448 kb/s
 Stream #1:0 : Audio : ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
[ac3 @ 0x55b37502ef80] Estimating duration from bitrate, this may be inaccurate
Input #2, ac3, from 'input_audio_stream_2.ac3' :
 Duration : 00:44:19.89, start : 0.000000, bitrate : 192 kb/s
 Stream #2:0 : Audio : ac3, 48000 Hz, stereo, fltp, 192 kb/s
[ac3 @ 0x55b374efc900] Estimating duration from bitrate, this may be inaccurate
Input #3, ac3, from 'input_audio_stream_3.ac3' :
 Duration : 00:43:19.18, start : 0.000000, bitrate : 384 kb/s
 Stream #3:0 : Audio : ac3, 48000 Hz, stereo, fltp, 384 kb/s
[ac3 @ 0x55b374fd60c0] Estimating duration from bitrate, this may be inaccurate
Input #4, ac3, from 'input_audio_stream_4.ac3' :
 Duration : 00:43:19.18, start : 0.000000, bitrate : 192 kb/s
 Stream #4:0 : Audio : ac3, 48000 Hz, stereo, fltp, 192 kb/s
Input #5, srt, from 'input_subtitle_stream_1.srt' :
 Duration : N/A, bitrate : N/A
 Stream #5:0 : Subtitle : subrip
Input #6, srt, from 'input_subtitle_stream_2.srt' :
 Duration : N/A, bitrate : N/A
 Stream #6:0 : Subtitle : subrip
[matroska @ 0x55b3751a1940] Invalid stream specifier : a:0 default.
 Last message repeated 1 times



I know it's reporting something with audio ([matroska @ 0x55b3751a1940] Invalid stream specifier : a:0 default. Last message repeated 1 times) but it's probably problem with my ffmpeg command.


-
How to limit cpu usage for a terminal command that works on m1 mac and macOS Monterey ?
18 juin 2024, par mcaayI have a m1 macbook pro and I regularly need to do some heave processing with
ffmpeg
. When I do it, all my 8 cores go at it 100% and my cpu temperature goes to 92°C, which I don't feel comfortable about.

I don't really need 100% speed, I'd much rather see 80°C and wait 5x longer for it to finish.


I use Macs Fan Control which sets my fan at 100% at 75°C, so this helps definitely, but is not enough.


I tried
ffmpeg -threads 1
parameter but it doesn't make a difference in compressing speed nor temperature, so I assume it just doesn't work.

I tried
cpulimit -l 60 -i ffmpeg ...
and it doesn't change a thing, so I assume it also doesn't work.cpulimit -l
value gives 100% for every core, socpulimit -l 800
should be 100%,-l 400
should be 50% and-l 60
should be 7.5%.

I tried
nice
and it is not for my use case. Even with the lowest priority the task uses all available cpu, resulting in 92°C.

Did anybody figure it out for m1 macs already ?