
Recherche avancée
Autres articles (47)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 (6352)
-
Difference between use subprocess.Popen() and run the command in shell mannually ? [duplicate]
6 février 2021, par hu chenlinimport subprocess
ffmpeg_params=['ffmpeg', '-y', '-i', 'http://cache.m.iqiyi.com/mus/235133201/2af150aebb98276a80d52513fb91fbc8/afbe8fd3d73448c9/0/20210115/1f/c5/cda301a0e8339c4cbcc89a4e9a6dafac.m3u8?qd_originate=tmts_py&tvid=1694459300&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1612598784271&qd_p=6011968c&qd_asc=d0d83b774212c40885a78123935cf7d4&qypid=1694459300_04022000001000000000_4&qd_k=7b1dacf9d318a810bd201e367ef98196&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=bb7741a4e27350139427f0051c641530&np_tag=nginx_part_tag', '-c', 'copy', '-bsf:a', 'aac_adtstoasc', '--', 'f:\\/【英语口语】我羡慕你.mp4']
b=subprocess.Popen(ffmpeg_params)



Using this simple .py script I can call ffmpeg to download the video file sucessfully.


However, if I run




ffmpeg -y -i
http://cache.m.iqiyi.com/mus/235133201/2af150aebb98276a80d52513fb91fbc8/afbe8fd3d73448c9/0/20210115/1f/c5/cda301a0e8339c4cbcc89a4e9a6dafac.m3u8?qd_originate=tmts_py&tvid=1694459300&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1612598784271&qd_p=6011968c&qd_asc=d0d83b774212c40885a78123935cf7d4&qypid=1694459300_04022000001000000000_4&qd_k=7b1dacf9d318a810bd201e367ef98196&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=bb7741a4e27350139427f0051c641530&np_tag=nginx_part_tag
-c copy -bsf:a aac_adtstoasc — f :/【英语口语】我羡慕你.mp4




in shell, it will fail with below message :




ffmpeg version N-90173-gfa0c9d69d3 Copyright (c) 2000-2018 the FFmpeg
developers built with gcc 7.3.0 (GCC) configuration : —enable-gpl
—enable-version3 —enable-sdl2 —enable-bzlib —enable-fontconfig —enable-gnutls —enable-iconv —enable-libass —enable-libbluray —enable-libfreetype —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libtheora —enable-libtwolame —enable-libvpx —enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxml2 —enable-libzimg —enable-lzma —enable-zlib —enable-gmp —enable-libvidstab —enable-libvorbis —enable-libvo-amrwbenc —enable-libmysofa —enable-libspeex —enable-libxvid —enable-libmfx —enable-amf —enable-cuda —enable-cuvid —enable-d3d11va —enable-nvenc —enable-dxva2 —enable-avisynth libavutil 56. 7.101 / 56. 7.101 libavcodec 58. 13.100 / 58. 13.100 libavformat 58. 10.100 /
58. 10.100 libavdevice 58. 2.100 / 58. 2.100 libavfilter 7. 12.100 / 7. 12.100 libswscale 5. 0.101 / 5. 0.101 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 /
55. 0.100 http://cache.m.iqiyi.com/mus/235133201/2af150aebb98276a80d52513fb91fbc8/afbe8fd3d73448c9/0/20210115/1f/c5/cda301a0e8339c4cbcc89a4e9a6dafac.m3u8?qd_originate=tmts_py :
Invalid data found when processing input 'tvid' is not recognized as
an internal or external command, operable program or batch file.
'bossStatus' is not recognized as an internal or external command,
operable program or batch file.




I can use subprocess.Popen to call the ffmpeg to download the video file successfully, However, I can't directly run ffmpeg in shell with the same parameters to download the file. Why ? How can I directly run ffmpeg in shell to download the file ?


-
execute shell script from php
11 juillet 2016, par Shortywhen i use a ffmpeg command in shell_exec it works, but when i want to execute the shellscript with a given value it doesn’t ...
$cmd='ffmpeg -i /home/shorty/stormfall/'.$upld.' -filter_complex "[0:v]boxblur=10[bg];[0:v]crop=1280:625:00:45[fg];[bg][fg]overlay=00:45" -c:v libx264 -c:a copy /home/shorty/stormfall/swf/temp.flv';
works but ;
$cmd="./home/shorty/stormfall/members/moviefilters.sh /home/shorty/stormfall/$upld";
not,
i use
file=$1
ffmpeg -i $1 -filter_complex "[0:v]boxblur=10[bg];[0:v]crop=1280:625:00:45[fg];[bg][fg]overlay=00:45" -c:v libx264 -c:a copy /home/shorty/stormfall/swf/temp.flvin script to get the value
any ideas to fix ?
-
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)