
Recherche avancée
Autres articles (68)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
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 (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (7750)
-
Converting ffmpeg CLI command to ffmpeg-python to get bytes of a MPEG Transport Stream data stream ?
28 août 2023, par kdeckerrI have the following code to get the bytes representing the data stream of a .ts video :


def get_datastream_bytes(mpeg_ts_filepath):
 ffmpeg_command = [
 'ffmpeg', '-hide_banner', '-loglevel', 'quiet',
 '-i', mpeg_ts_filepath,
 '-map', '0:d',
 '-c', 'copy',
 '-copy_unknown',
 '-f', 'data',
 'pipe:1'
 ]

 try:
 output_bytes = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
 print("Output bytes length:", len(output_bytes))
 return output_bytes
 except subprocess.CalledProcessError as e:
 print("Error:", e.output)



I can then wrap the returned value in
io.BytesIO
and parse the resulting bytes using another library (klvdata
).

This code was fashioned upon a ffmpeg CLI command I adapted from this SO Answer.


ffmpeg -i "C:\inputfile.ts" -map 0:d -c copy -copy_unknown -f:d data pipe:1




What I would really like to do is utilize the Python ffmpeg bindings in
ffmpeg-python
so that users do not have to install ffmpeg locally. Thus, I have attempted to get a bytes stream from anffmpeg
call like so :

bytestream = (
 ffmpeg.input(input_file)
 .output("pipe:", format="data", codec="copy", copy_unknown=True)
 .run(capture_stdout=True)
)



Though, this and many other, attempts at utilizing
ffmpeg-python
generally end with the same error :



Output #0, data, to 'True' :
[out#0/data @ 00000...] Output file does not contain any stream
Error opening output file True.
Error opening output files : Invalid argument
Traceback (most recent call last) :
...
raise Error('ffmpeg', out, err)
ffmpeg._run.Error : ffmpeg error (see stderr output for detail)





How do I convert the ffmpeg CLI command


ffmpeg -i "C:\inputfile.ts" -map 0:d -c copy -copy_unknown -f:d data pipe:1



To an
ffmpeg-python
call ?

-
FFMPEG - local video to UDP streaming to OpenCV - video quality degraded
6 juin 2021, par user3925023my goal is to re-stream local video content / desktop screencasting, to an UDP flow that I need to process on a Python script.



Here is the FFMPEG script that I'm using :



ffmpeg -re -i C:\Users\test\Downloads\out.ts -strict -2 -c:v copy -an -preset slower -tune stillimage -b 11200k -f rawvideo udp://127.0.0.1:5000




And here is the simple Python script supposed to read the stream flow :



import cv2

cap = cv2.VideoCapture('udp://127.0.0.1:5000',cv2.CAP_FFMPEG)
if not cap.isOpened():
 print('VideoCapture not opened')
 exit(-1)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) # float
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) # float
print(str(width))
print(str(height))
while True:
 ret, frame = cap.read()
 imgray = frame[int(round((height/100)*70,0)):int(round((width/100)*42,0)), int(round((height/100)*74,0)):int(round((width/100)*54,0))]
 if not ret:
 print('frame empty')
 break
 cv2.imshow('image', imgray)
 if cv2.waitKey(1)&0XFF == ord('q'):
 break
cap.release()




I'm able to visualize portion of the stream video as expect, but I'm facing lot of issue in video quality degradation, specially video artifact probably due missing packet processing :






Also these are error log I'm geting from script :



[h264 @ 0000026eb272f280] error while decoding MB 105 66, bytestream -21
[h264 @ 0000026eb2fcb740] error while decoding MB 100 53, bytestream -11
[h264 @ 0000026eb272f280] error while decoding MB 32 22, bytestream -11
[h264 @ 0000026ead9ee300] error while decoding MB 60 20, bytestream -25
[h264 @ 0000026eb27f00c0] error while decoding MB 9 62, bytestream -5
[h264 @ 0000026ead9ee780] error while decoding MB 85 44, bytestream -5
[h264 @ 0000026eb27f0800] error while decoding MB 64 25, bytestream -15
[h264 @ 0000026eb272f280] error while decoding MB 112 23, bytestream -17
[h264 @ 0000026eb2735200] error while decoding MB 30 21, bytestream -7




Actually I don't care about video fluidity,I can also reduce the FPS, important thing is the video quality. Not sure if I'm doing wrong on the scripting python part or if I'm using wrong FFMPEG command.



Many Thanks


-
swresample : Add AVFrame based API
11 août 2014, par Michael Niedermayerswresample : Add AVFrame based API
Based on commit fb1ddcdc8f51b9d261ae8e9c26b91e81f7b6bf45 by Luca Barbato <lu_zero@gentoo.org>
Adapted for libswresample by Michael Niedermayer
Signed-off-by : Michael Niedermayer <michaelni@gmx.at>