
Recherche avancée
Autres articles (47)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
Diogene : création de masques spécifiques de formulaires d’édition de contenus
26 octobre 2010, parDiogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
A quoi sert ce plugin
Création de masques de formulaires
Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)
Sur d’autres sites (6800)
-
How to get frames from HDR video in scRGB color space ?
5 mars 2018, par Виталий СинявскийI want to create a simple video player that will show HDR video on HDR TV. For example, this "LG Chess HDR" video. It is encoded with HEVC, its bit depth is 10 bit, pixel format is YUV420P10LE and it has metadata abount BT2020 color space and PQ transfer function.
In this NVIDIA article I found the next :
The display driver takes the scRGB back buffer, and converts it to the
standard expected by the display presently connected. In general, this
means converting the color space from sRGB primaries to BT. 2020
primaries, scaling to an appropriate level, and encoding with a
mechanism like PQ. Also, possibly performing conversions like RGB to
YCC if that display connection requires it.It means that my player should render pixels in the scRGB color space (linear encoding, sRGB primaries, full range is -0.5 through just less than +7.5). So I need to get frames from the source video in this color space somehow, preferably in FP16 pixel format (half float, 16 bits per one color channel). I come to the following simple pipeline to render videos to HDR :
source HDR video in BT2020 color space with applied PQ -> [some video library] ->
-> video frames with colors in scRGB color space -> [my program] ->
-> rendered video on HDR TV with applied conversions by display driverI’m trying to use FFmpeg as this library and do not understand how to get frames from the source HDR video in scRGB color space.
I use sws_scale FFmpeg method now to get frames and know about filters API. But I did not found any information and help about how to transparantly get frames in scRGB using these functionality without parsing metadata for all source videos and create custom video filters for them.
Please, tell me what I can do to get frames in the scRGB color space using FFmpeg. Can someone tell other libraries with which I can do it ?
-
What am I doing wrong ? Tweepy with ffmpeg
27 août 2020, par pigeonburgerI'm trying to get this code to pull the media from any tweet that mentions my twitter handle, convert it using ffmpeg via the subprocess module, then send the converted media back to the person as a reply ? Is this all correct ?

I am also getting an error at
tweet_media = clean_data['entities']['media']['media_url']
and I don't understand what I'm doing wrong there (Exception has occurred : TypeError
list indices must be integers or slices, not str
line 32, in on_data
tweet_media = clean_data['entities']['media']['media_url'])

Also is there a better way to use ffmpeg with python that I am not aware of ?


Here is the code I wrote that I'm trying to use :


import tweepy
from tweepy import Stream
from tweepy.streaming import StreamListener
from datetime import datetime
import time
import subprocess

stdout = subprocess.PIPE
def runcmd(cmd):
 x = subprocess.Popen(cmd, stdout=subprocess.PIPE)
 return x.communicate(stdout)

print(" TWITTER BOT")
time.sleep(1.5)
print(" By PigeonBurger, updated 26 August 2020 \n")

import json
import random

class StdOutListener(StreamListener):
 def on_data(self, data):
 clean_data = json.loads(data)
 tweetId = clean_data['id']
 tweet_name = clean_data['user']['screen_name']
 tweet_media = clean_data['entities']['media']['media_url']
 tweet_photo = runcmd('ffmpeg -i tweet_media output.jpg')
 print(clean_data)
 tweet = 'Here ya go'
 now = datetime.now()
 dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
 print(' Reply sent to @'+tweet_name, 'on', dt_string, '\n' ' Message:', tweet, '\n')
 respondToTweet(tweet_photo, tweet, tweetId)

def setUpAuth():
 auth = tweepy.OAuthHandler("consumer_key", "consumer_secret")
 auth.set_access_token("access_token", "access_token_secret")
 api = tweepy.API(auth)
 return api, auth

def followStream():
 api, auth = setUpAuth()
 listener = StdOutListener()
 stream = Stream(auth, listener)
 stream.filter(track=["@YOUR_TWITTER_HANDLE"], is_async=True)

def respondToTweet(tweet_photo, tweet, tweetId):
 api, auth = setUpAuth()
 api.update_with_media(tweet_photo, tweet, in_reply_to_status_id=tweetId, auto_populate_reply_metadata=True, stall_warnings=True)

if __name__ == "__main__":
 followStream()



-
Live stream is gets delayed while processing frame in opencv + python
18 mars 2021, par Himanshu sharmaI capture and process an IP camera RTSP stream in a OpenCV 4.4.0.46 on Ubuntu.
Unfortunately the processing takes quite a lot of time, roughly 0.2s per frame, and the stream quickly gets delayed.
Video file have to save for 5 min but by this delaying video file is saved for 3-4 min only.


Can we process faster to overcome delays ?


I have two IP camera which have two diffrent fps_rate(Camera 1 have 18000 and camera 2 have 20 fps)


I am implementing this code in difference Ubuntu PCs


- 

- Python 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] on linux
- Django==3.1.2
- Ubuntu = 18.04 and 20.04
- opencv-contrib-python==4.4.0.46
- opencv-python==4.4.0.46












input_stream = 'rtsp://'+username+':'+password+'@'+ip+'/user='+username+'_password='+password+'_channel=0channel_number_stream=0.sdp'
input_stream---> rtsp://admin:Admin123@192.168.1.208/user=admin_password=Admin123_channel=0channel_number_stream=0.sdp

input_stream---> rtsp://Admin:@192.168.1.209/user=Admin_password=_channel=0channel_number_stream=0.sdp

vs = cv2.VideoCapture(input_stream)
fps_rate = int(vs.get(cv2.CAP_PROP_FPS))
I have two IP camera which have two diffrent fps_rate(Camera 1 have 18000 and camera 2 have 20 fps)

video_file_name = 0
start_time = time.time()
while(True):
 ret, frame = vs.read()
 time.sleep(0.2) # <= Simulate processing time (mask detection, face detection and many detection is hapning)


 ### Start of writing a video to disk 
 minute = 5 ## saving a file for 5 minute only then saving another file for 5 min
 second = 60
 minite_to_save_video = int(minute) * int(second)


 # if we are supposed to be writing a video to disk, initialize
 if time.time() - start_time >= minite_to_save_video or video_file_name == 0 :
 ## where H = heigth, W = width, C = channel 
 H, W, C = frame.shape
 
 print('time.time()-->',time.time(),'video_file_name-->', video_file_name, ' #####')
 start_time = time.time()

 video_file_name = str(time.mktime(datetime.datetime.now().timetuple())).replace('.0', '')
 output_save_directory = output_stream+str(int(video_file_name))+'.mp4'


 fourcc = cv2.VideoWriter_fourcc(*'avc1')
 
 writer = cv2.VideoWriter(output_save_directory, fourcc,20.0,(W, H), True)

 # check to see if we should write the frame to disk
 if writer is not None:
 
 try:
 writer.write(frame)

 except Exception as e:
 print('Error in writing video output---> ', e)