
Recherche avancée
Autres articles (6)
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...)
Sur d’autres sites (3863)
-
Send inputs to a process (ffmpeg) using python
10 mai 2023, par NoddyI am trying to program a custom screen recording functionality, but I have problems sending input to a process.


To achieve this I use
ffmpeg
. The idea is that I have two scripts A and B

A : Begin recording - create a
ffmpeg
subprocess that records the screen and writes the process id (pid) to a file

B : Stop the recording - Read the pid from the file and send a 'q' input to the process to stop the recording


This is my code :


A :


import shlex
import subprocess
import time
import datetime

# Variables
success = True
flowName = "workflow1"

# Get current date and time
now = datetime.datetime.now()

formatted_date = now.strftime("%Y-%m-%d %H:%M:%S")

folderDestination = f"C:\\Users\\MadPe\\Desktop\\pipRec\\workFlows\\{flowName}\\"

formatted_date = formatted_date.replace(":",".").replace(" ","_")

fileName = folderDestination + formatted_date + ".mp4"

ffmpegPath = r"C:\Users\MadPe\Desktop\pipRec\ffmpeg\bin\ffmpeg.exe"

command = shlex.split(f'"{ffmpegPath}" -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -y "{fileName}"')
process = subprocess.Popen(command, stdin=subprocess.PIPE)

pid = process.pid
startTime = time.time()

with open("filename.txt", "w") as file:
 file.write(str(pid))

#process.stdin.write(b'q\n') #-- this is how I stop the recording
#process.stdin.flush() #-- but I want to do this from another script



B :


import psutil

# Stop recording and kill Process
with open("filename.txt", "r") as f:
 pid = int(f.read().strip())

if psutil.pid_exists(pid):
 process = psutil.Process(pid)
 process.stdin.write(b'q\n')
 process.stdin.flush()
else:
 print(f"Process with PID {pid} is not running.")



however, when I try to stop the running process I get this error :




I hope some of you may be able to spot what I am doing wrong.
also if I comment in the last two lines in A it will make the recording stop, but I want to be able to do this from running B


demo : https://www.veed.io/view/ab4ef053-bba9-43f9-85c5-6ca18204ea37?sharingWidget=true&panel=share


-
Hello. I'd like to play a video on my app on android, I tried with videoplayer, it works but doesn't load the video simply open theUI but not thevideo
26 octobre 2022, par AbdulI'd like to play a video on my app on android, I tried with videoplayer, it works but doesn't load the video ( simply open the UI but not the video).


I found out i may need ffpyplayer so I changed buildozer requirements :
requirements = python3,kivy, android,ffpyplayer


but buildozer failed to build apk when i added ffpyplayer and ffmpeg in buildozer.spec file in requirement.


[DEBUG]: If you think configure made a mistake, make sure you are using the latest
[DEBUG]: version from Git. If the latest version fails, report the problem to the
[DEBUG]: ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
[DEBUG]: Include the log file "ffbuild/config.log" produced by configure as this will help
[DEBUG]: solve the problem.
Exception in thread background thread for pid 77802:
Traceback (most recent call last):
 File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
 self.run()
 File "/usr/lib/python3.7/threading.py", line 870, in run
 self._target(*self._args, **self._kwargs)
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 1641, in wrap
 fn(*rgs, **kwargs)
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 2569, in background_thread
 handle_exit_code(exit_code)
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 2269, in fn
 return self.command.handle_command_exit_code(exit_code)
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 869, in handle_command_exit_code
 raise exc
sh.ErrorReturnCode_1: 

 RAN: /content/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg/configure --disable-everything --enable-openssl --enable-nonfree --enable-protocol=https,tls_openssl --enable-gpl --enable-libx264 --enable-libshine --enable-libvpx --enable-parsers --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --disable-symver --disable-programs --disable-doc --enable-filter=aresample,resample,crop,adelay,volume,scale --enable-protocol=file,http,hls,udp,tcp --enable-small --enable-hwaccels --enable-pic --disable-static --disable-debug --enable-shared --target-os=android --enable-cross-compile --cross-prefix=armv7a-linux-androideabi21- --arch=arm --strip=/root/.buildozer/android/platform/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --sysroot=/root/.buildozer/android/platform/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --enable-neon --prefix=/content/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg

 STDOUT:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
armv7a-linux-androideabi21-clang is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.


 STDERR:


Traceback (most recent call last):
 File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
 "__main__", mod_spec)
 File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
 exec(code, run_globals)
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1297, in <module>
 main()
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
 ToolchainCL()
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 730, in __init__
 getattr(self, command)(args)
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 153, in wrapper_func
 build_dist_from_args(ctx, dist, args)
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 215, in build_dist_from_args
 args, "ignore_setup_py", False
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 505, in build_recipes
 recipe.build_arch(arch)
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/ffmpeg/__init__.py", line 143, in build_arch
 shprint(configure, *flags, _env=env)
 File "/content/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
 for line in output:
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 915, in next
 self.wait()
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 845, in wait
 self.handle_command_exit_code(exit_code)
 File "/usr/local/lib/python3.7/dist-packages/sh.py", line 869, in handle_command_exit_code
 raise exc
sh.ErrorReturnCode_1: 

 RAN: /content/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg/configure --disable-everything --enable-openssl --enable-nonfree --enable-protocol=https,tls_openssl --enable-gpl --enable-libx264 --enable-libshine --enable-libvpx --enable-parsers --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --disable-symver --disable-programs --disable-doc --enable-filter=aresample,resample,crop,adelay,volume,scale --enable-protocol=file,http,hls,udp,tcp --enable-small --enable-hwaccels --enable-pic --disable-static --disable-debug --enable-shared --target-os=android --enable-cross-compile --cross-prefix=armv7a-linux-androideabi21- --arch=arm --strip=/root/.buildozer/android/platform/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --sysroot=/root/.buildozer/android/platform/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --enable-neon --prefix=/content/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/ffmpeg/armeabi-v7a__ndk_target_21/ffmpeg

 STDOUT:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
armv7a-linux-androideabi21-clang is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.


 STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,ffpyplayer,kivy,openssl,certifi,android,pytube,plyer,pyjnius,kivmob,jnius,future,libshine,libx264,ffpyplayer_codecs,Pillow,liblzma,opencv,requests,urllib3,chardet,idna,youtube_search --arch armeabi-v7a --copy-libs --color=always --storage-dir="/content/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug
# ENVIRONMENT:
# NV_LIBCUBLAS_DEV_VERSION = '11.4.1.1043-1'
# NV_CUDA_COMPAT_PACKAGE = 'cuda-compat-11-2'
# NV_CUDNN_PACKAGE_DEV = 'libcudnn8-dev=8.1.1.33-1+cuda11.2'
# PYDEVD_USE_FRAME_EVAL = 'NO'
# LD_LIBRARY_PATH = '/usr/local/nvidia/lib:/usr/local/nvidia/lib64'
# NV_LIBNCCL_DEV_PACKAGE = 'libnccl-dev=2.8.4-1+cuda11.2'
# TCLLIBPATH = '/usr/share/tcltk/tcllib1.19'
# CLOUDSDK_PYTHON = 'python3'
# LANG = 'en_US.UTF-8'
# NV_LIBNPP_DEV_PACKAGE = 'libnpp-dev-11-2=11.3.2.152-1'
# ENABLE_DIRECTORYPREFETCHER = '1'
# HOSTNAME = '875ade0bb031'
# OLDPWD = '/'
# CLOUDSDK_CONFIG = '/content/.config'
# USE_AUTH_EPHEM = '1'
# NV_LIBNPP_VERSION = '11.3.2.152-1'
# NV_NVPROF_DEV_PACKAGE = 'cuda-nvprof-11-2=11.2.152-1'
# NVIDIA_VISIBLE_DEVICES = 'all'
# NV_NVPROF_VERSION = '11.2.152-1'
# NV_LIBCUSPARSE_VERSION = '11.4.1.1152-1'
# DATALAB_SETTINGS_OVERRIDES = '{"kernelManagerProxyPort":6000,"kernelManagerProxyHost":"172.28.0.3","jupyterArgs":["--ip=172.28.0.2"],"debugAdapterMultiplexerPath":"/usr/local/bin/dap_multiplexer","enableLsp":true}'
# NV_LIBCUBLAS_DEV_PACKAGE = 'libcublas-dev-11-2=11.4.1.1043-1'
# ENV = '/root/.bashrc'
# PAGER = 'cat'
# NCCL_VERSION = '2.8.4-1'
# TF_FORCE_GPU_ALLOW_GROWTH = 'true'
# JPY_PARENT_PID = '60'
# NO_GCE_CHECK = 'False'
# PWD = '/content'
# NVARCH = 'x86_64'
# NV_LIBCUSPARSE_DEV_VERSION = '11.4.1.1152-1'
# HOME = '/root'
# KMP_LISTEN_PORT = '6000'
# LAST_FORCED_REBUILD = '20221021'
# CLICOLOR = '1'
# NV_LIBNCCL_PACKAGE_VERSION = '2.8.4-1'
# NV_LIBNCCL_PACKAGE = 'libnccl2=2.8.4-1+cuda11.2'
# DEBIAN_FRONTEND = 'noninteractive'
# NV_LIBNCCL_DEV_PACKAGE_NAME = 'libnccl-dev'
# NV_CUDA_LIB_VERSION = '11.2.2-1'
# NV_LIBNPP_PACKAGE = 'libnpp-11-2=11.3.2.152-1'
# NV_LIBNCCL_PACKAGE_NAME = 'libnccl2'
# LIBRARY_PATH = '/usr/local/cuda/lib64/stubs'
# NV_NVTX_VERSION = '11.2.152-1'
# NV_LIBCUBLAS_VERSION = '11.4.1.1043-1'
# NV_LIBCUBLAS_PACKAGE = 'libcublas-11-2=11.4.1.1043-1'
# GCE_METADATA_TIMEOUT = '3'
# NV_CUDNN_VERSION = '8.1.1.33'
# VM_GCE_METADATA_HOST = '169.254.169.254'
# NV_CUDA_CUDART_DEV_VERSION = '11.2.152-1'
# KMP_TARGET_PORT = '9000'
# GLIBCPP_FORCE_NEW = '1'
# TBE_CREDS_ADDR = '172.28.0.1:8008'
# TERM = 'xterm-color'
# SHELL = '/bin/bash'
# GCS_READ_CACHE_BLOCK_SIZE_MB = '16'
# NV_NVML_DEV_VERSION = '11.2.152-1'
# PYTHONWARNINGS = 'ignore:::pip._internal.cli.base_command'
# MPLBACKEND = 'module://ipykernel.pylab.backend_inline'
# CUDA_VERSION = '11.2.2'
# NV_LIBCUBLAS_PACKAGE_NAME = 'libcublas-11-2'
# NVIDIA_DRIVER_CAPABILITIES = 'compute,utility'
# TBE_RUNTIME_ADDR = '172.28.0.1:8011'
# SHLVL = '1'
# PYTHONPATH = '/env/python'
# NV_LIBCUBLAS_DEV_PACKAGE_NAME = 'libcublas-dev-11-2'
# NVIDIA_REQUIRE_CUDA = ('cuda>=11.2 brand=tesla,driver>=418,driver<419 '
 'brand=tesla,driver>=450,driver<451')
# NV_LIBNPP_DEV_VERSION = '11.3.2.152-1'
# TBE_EPHEM_CREDS_ADDR = '172.28.0.1:8009'
# NV_CUDA_CUDART_VERSION = '11.2.152-1'
# NV_CUDNN_PACKAGE_NAME = 'libcudnn8'
# GLIBCXX_FORCE_NEW = '1'
# PATH = '/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/opt/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin'
# NV_LIBNCCL_DEV_PACKAGE_VERSION = '2.8.4-1'
# LD_PRELOAD = '/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4'
# NV_CUDNN_PACKAGE = 'libcudnn8=8.1.1.33-1+cuda11.2'
# GIT_PAGER = 'cat'
# _ = '/usr/local/bin/buildozer'
# PACKAGES_PATH = '/root/.buildozer/android/packages'
# ANDROIDSDK = '/root/.buildozer/android/platform/android-sdk'
# ANDROIDNDK = '/root/.buildozer/android/platform/android-ndk-r23b'
# ANDROIDAPI = '30'
# ANDROIDMINAPI = '21'
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
</module>


kindly help me anyone would be very appreciate thank you.


-
Can i limit CPU usage of my Script ? Raspberry pi cpu crashing - rebooting [duplicate]
5 novembre 2024, par Mateus CoelhoI have a script, in python, that converts a video of 11mb, 30fps, 1080p. the code puts 4 imagens into it, with overlay, and rotates 90.
When i run the script into the raspberry pi, it goes off CPU, all the 4 threads go to 100% and it suently reboots.


Raspberry pi 4 b 4gb


I want to limit the cpu to like 60% to the script... its not a problems to be longer in time.


import subprocess
import sys
import time
import psutil
import os

def overlay_images_on_video(input_file, image_files, output_file, positions, image_size=(100, 100), opacity=0.7):
 start_time = time.time()
 process = psutil.Process(os.getpid())

 inputs = ['-i', input_file]
 for image in image_files:
 if image:
 inputs += ['-i', image]
 filter_complex = "[0:v]transpose=2[rotated];"
 current_stream = "[rotated]"
 for i, (x_offset, y_offset) in enumerate(positions):
 filter_complex += f"[{i+1}:v]scale={image_size[0]}:{image_size[1]},format=rgba,colorchannelmixer=aa={opacity}[img{i}];"
 filter_complex += f"{current_stream}[img{i}]overlay={x_offset}:{y_offset}"
 if i < len(positions) - 1:
 filter_complex += f"[tmp{i}];"
 current_stream = f"[tmp{i}]"
 else:
 filter_complex += ""
 command = ['ffmpeg', '-threads', '1'] + inputs + ['-filter_complex', filter_complex, output_file]
 
 try:
 subprocess.run(command, check=True)
 print(f"Vídeo processado com sucesso: {output_file}")
 except subprocess.CalledProcessError as e:
 print(f"Erro ao processar o vídeo: {e}")
 
 # Monitoramento de tempo, memória e CPU
 elapsed_time = time.time() - start_time
 memory_info = process.memory_info()
 cpu_usage = process.cpu_percent(interval=1)
 print(f"Tempo de execução: {elapsed_time:.2f} segundos")
 print(f"Memória usada: {memory_info.rss / (1024 * 1024):.2f} MB")
 print(f"Uso de CPU: {cpu_usage}%")
 
 # Monitoramento de GPU (se disponível)
 try:
 gpu_usage = subprocess.check_output(
 ["nvidia-smi", "--query-gpu=utilization.gpu", "--format=csv,noheader,nounits"]
 ).decode("utf-8").strip()
 print(f"Uso de GPU: {gpu_usage}%")
 except FileNotFoundError:
 print("GPU não detectada ou `nvidia-smi` não está disponível.")

if __name__ == "__main__":
 input_video = sys.argv[1]
 image_files = sys.argv[2:5]
 output_video = sys.argv[5]
 
 positions = [(10, 10), (35, 1630), (800, 1630)]
 overlay_images_on_video(input_video, image_files, output_video, positions, image_size=(250, 250), opacity=0.8)



EDITED :


The 4 cores of the CPU goes to 100%, i can see in another ssh terminal via htop, and it sudently reboots.
I have other 9 scripts running on the back, 6 ffmpeg stremas and 3 others to caputre the videos. When i add this logic to the other 3 that captures the video or i try to run directly one time, it reboots