
Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
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
Autres articles (90)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (10669)
-
Non-blocking realtime read from multiple shell subprocesses (Python)
8 février 2018, par Norman EdanceI’m building real time multiple videostream monitoring using ffmpeg and subrocess.
I currently have the following code, inspired by "Async and await with subprocesses" post.The problem is that after a certain period of time the output stops printing and the processes go into zombie mode. I guess that this problem is related to the overload of PIPE or deadlock. Help needed.
"""Async and await example using subprocesses
Note:
Requires Python 3.6.
"""
import os
import sys
import time
import platform
import asyncio
async def run_command_shell(command):
"""Run command in subprocess (shell)
Note:
This can be used if you wish to execute e.g. "copy"
on Windows, which can only be executed in the shell.
"""
# Create subprocess
process = await asyncio.create_subprocess_shell(
command,
stderr=asyncio.subprocess.PIPE)
# Status
print('Started:', command, '(pid = ' + str(process.pid) + ')')
# Wait for the subprocess to finish
stdout, stderr = await process.communicate()
# Progress
if process.returncode == 0:
print('Done:', command, '(pid = ' + str(process.pid) + ')')
else:
print('Failed:', command, '(pid = ' + str(process.pid) + ')')
# Result
result = stderr.decode().strip()
# Real time print
print(result)
# Return stdout
return result
def make_chunks(l, n):
"""Yield successive n-sized chunks from l.
Note:
Taken from https://stackoverflow.com/a/312464
"""
if sys.version_info.major == 2:
for i in xrange(0, len(l), n):
yield l[i:i + n]
else:
# Assume Python 3
for i in range(0, len(l), n):
yield l[i:i + n]
def run_asyncio_commands(tasks, max_concurrent_tasks=0):
"""Run tasks asynchronously using asyncio and return results
If max_concurrent_tasks are set to 0, no limit is applied.
Note:
By default, Windows uses SelectorEventLoop, which does not support
subprocesses. Therefore ProactorEventLoop is used on Windows.
https://docs.python.org/3/library/asyncio-eventloops.html#windows
"""
all_results = []
if max_concurrent_tasks == 0:
chunks = [tasks]
else:
chunks = make_chunks(l=tasks, n=max_concurrent_tasks)
for tasks_in_chunk in chunks:
if platform.system() == 'Windows':
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
else:
loop = asyncio.get_event_loop()
commands = asyncio.gather(*tasks_in_chunk) # Unpack list using *
results = loop.run_until_complete(commands)
all_results += results
loop.close()
return all_results
if __name__ == '__main__':
start = time.time()
if platform.system() == 'Windows':
# Commands to be executed on Windows
commands = [
['hostname']
]
else:
# Commands to be executed on Unix
commands = [
['du', '-sh', '/var/tmp'],
['hostname'],
]
cmds = [["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"]]
tasks = []
for command in cmds:
tasks.append(run_command_shell(*command))
# # Shell execution example
# tasks = [run_command_shell('copy c:/somefile d:/new_file')]
# # List comprehension example
# tasks = [
# run_command(*command, get_project_path(project))
# for project in accessible_projects(all_projects)
# ]
results = run_asyncio_commands(tasks, max_concurrent_tasks=20) # At most 20 parallel tasks
print('Results:', results)
end = time.time()
rounded_end = ('{0:.4f}'.format(round(end-start,4)))
print('Script ran in about', str(rounded_end), 'seconds')Related : Non-blocking read from multiple subprocesses (Python)
-
how would i play a large list of mp3 and wav files while showing the name of it on the screen with ffmpeg
4 juillet 2023, par iiDki've been attempting to make a video that is autogenerated using ffmpeg that plays a list of audios and while they are playing it shows the name of the audio file on the screen. i have no idea how to use ffmpeg and i abused ai for the provided script, but it's stupid and doesn't know how to properly reencode the file fixing the bugs at the end which cause the audio to only be on the left channel for no reason and then eventually cutting out.


import os
import subprocess

def create_combined_video(audio_folder, output_path):
 # Get a list of audio files in the specified folder
 audio_files = []
 for filename in os.listdir(audio_folder):
 if filename.endswith(".mp3") or filename.endswith(".wav"):
 audio_files.append(os.path.join(audio_folder, filename))

 # Sort the audio files alphabetically
 audio_files.sort()

 # Create a folder to store the temporary image frames
 temp_frames_folder = "temp_frames"
 os.makedirs(temp_frames_folder, exist_ok=True)

 # Generate the image frames with the corresponding audio file names
 for index, audio_file in enumerate(audio_files):
 name = os.path.splitext(os.path.basename(audio_file))[0]
 image_path = os.path.join(temp_frames_folder, f"{index+1:06d}.jpg")

 # Use FFmpeg to create the image frame with text overlay
 ffmpeg_cmd = f'ffmpeg -y -f lavfi -i color=c=white:s=720x480:d=1 -vf "drawtext=text=\'{name}\':fontcolor=black:fontsize=36:x=(w-text_w)/2:y=(h-text_h)/2" -vframes 1 "{image_path}"'
 subprocess.run(ffmpeg_cmd, shell=True)

 # Generate a text file containing the image file names for each audio
 image_names_path = "image_names.txt"
 with open(image_names_path, "w") as file:
 for index, audio_file in enumerate(audio_files):
 image_path = os.path.join(temp_frames_folder, f"{index+1:06d}.jpg")
 duration = get_audio_duration(audio_file)
 file.write(f"file '{image_path}'\nduration {duration}\n")

 # Generate a text file containing the audio file names
 audio_names_path = "audio_names.txt" 
 with open(audio_names_path, "w") as file:
 for audio_file in audio_files:
 file.write(f"file '{audio_file}'\n")

 # Re-encode the audio files with a common codec (AAC)
 reencoded_audio_folder = "reencoded_audio"
 os.makedirs(reencoded_audio_folder, exist_ok=True)
 for index, audio_file in enumerate(audio_files):
 reencoded_audio_file = os.path.join(reencoded_audio_folder, f"{index:03d}.m4a")
 ffmpeg_cmd = f'ffmpeg -y -i "{audio_file}" -c:a aac "{reencoded_audio_file}"'
 subprocess.run(ffmpeg_cmd, shell=True)

 # Generate a text file containing the re-encoded audio file names
 reencoded_audio_names_path = "reencoded_audio_names.txt"
 with open(reencoded_audio_names_path, "w") as file:
 for index, audio_file in enumerate(audio_files):
 reencoded_audio_file = os.path.join(reencoded_audio_folder, f"{index:03d}.m4a")
 file.write(f"file '{reencoded_audio_file}'\n")

 # Use FFmpeg to generate the video with the image frames and re-encoded audio
 ffmpeg_cmd = f'ffmpeg -y -f concat -safe 0 -i "{image_names_path}" -f concat -safe 0 -i "{reencoded_audio_names_path}" -c:v libx264 -pix_fmt yuv420p -vf "scale=720:480:force_original_aspect_ratio=increase,crop=720:480" -c:a aac -shortest "{output_path}"'
 subprocess.run(ffmpeg_cmd, shell=True)

 # Clean up temporary files and folders
 os.remove(image_names_path)
 os.remove(audio_names_path)
 for image_file in os.listdir(temp_frames_folder):
 os.remove(os.path.join(temp_frames_folder, image_file))
 os.rmdir(temp_frames_folder)
 for audio_file in os.listdir(reencoded_audio_folder):
 os.remove(os.path.join(reencoded_audio_folder, audio_file))
 os.rmdir(reencoded_audio_folder)

def get_audio_duration(audio_file): 
 # Use FFprobe to get the duration of the audio file
 ffprobe_cmd = f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{audio_file}"'
 result = subprocess.run(ffprobe_cmd, shell=True, capture_output=True, text=True)
 duration = float(result.stdout.strip())
 return duration

# Usage example
audio_folder = "C:/Users/Admin/Desktop/Sounds"
output_path = "C:/Users/Admin/Desktop/output.mp4"
create_combined_video(audio_folder, output_path)



i've tried yelling at ai to fix the bug and all it does is break the script instead of doing what i asked it to, but i believe all it has to do is fix reencoding


-
link error Xcode libx264.a ARM
19 novembre 2013, par user1558688I'm trying to build libx264.a to run on my iphone 4s ( running iOS 6.1.3 )
I'm building it using the MACOSX 10.9 Terminal application :
CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang ./configure
--host=arm-apple-darwin
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
--prefix=armv7
--extra-cflags='-no-integrated-as -arch armv7'
--extra-ldflags="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/system -arch armv7"
--enable-pic --enable-staticWhich guives me the output :
platform: ARM
system: MACOSX
cli: yes
libx264: internal
shared: no
static: yes
asm: yes
interlaced: yes
avs: avxsynth
lavf: no
ffms: no
mp4: no
gpl: yes
thread: posix
opencl: yes
filters: crop select_every
debug: no
gprof: no
strip: no
PIC: yes
bit depth: 8
chroma format: allThen I run 'make' and it generates a libx264.a archive.
So far, so good.
On my Xcode (Version 5.0.2 (5A3005)) application I set :
1) Build Settings -> Header Search Path -> x264 parent directory (../x264 )
2) Build Phases -> Link Library with Binaries -> Add Other... ( ../x264/libx264.a )
3) Build Settings -> Other Linker Flags : -ObjCIn my AppDelegate.mm :
#import "AppDelegate.h"
#import "x264.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
x264_param_t x264param;
x264_param_default(&x264param);
// Override point for customization after application launch.
return YES;
}
...When i try to run it on the device I get the error :
Undefined symbols for architecture armv7:
"x264_param_default(x264_param_t*)", referenced from:
-[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1
(use -v to see invocation)Here is the command invoked by xcode :
Ld /Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Products/Debug-iphoneos/testingCpp.app/testingCpp normal armv7
cd /Users/danieldantas/Desktop/projects/testingCpp
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-L/Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Products/Debug-iphoneos
-L/Users/danieldantas/Desktop/projects/testingCpp -L/Users/danieldantas/Desktop/projects/x264
-F/Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Products/Debug-iphoneos
-filelist /Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Intermediates/testingCpp.build/Debug-iphoneos/testingCpp.build/Objects-normal/armv7/testingCpp.LinkFileList
-dead_strip -ObjC -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -lx264 -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker
/Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Intermediates/testingCpp.build/Debug-iphoneos/testingCpp.build/Objects-normal/armv7/testingCpp_dependency_info.dat -o
/Users/danieldantas/Library/Developer/Xcode/DerivedData/testingCpp-bvawshyhjcybwvadwwwjqxuomjts/Build/Products/Debug-iphoneos/testingCpp.app/testingCppAny idea how to fix this ?
Thanks