
Recherche avancée
Autres articles (12)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...)
Sur d’autres sites (4337)
-
AWS Lambda subprocess OSError : [Errno 2] No such file or directory
11 septembre 2016, par LevI’m trying to create a lambda function that makes collection of thumbnails from a video on amazon s3 using ffmpeg. ffmpeg binary is included into fuction package.
function code :
# -*- coding: utf-8 -*-
import stat
import shutil
import boto3
import logging
import subprocess as sp
import os
import threading
thumbnail_prefix = 'thumb_'
thumbnail_ext = '.jpg'
time_delta = 1
video_frames_path = 'media/videos/frames'
print('Loading function')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
lambda_tmp_dir = '/tmp' # Lambda fuction can use this directory.
# ffmpeg is stored with this script.
# When executing ffmpeg, execute permission is requierd.
# But Lambda source directory do not have permission to change it.
# So move ffmpeg binary to `/tmp` and add permission.
ffmpeg_bin = "{0}/ffmpeg.linux64".format(lambda_tmp_dir)
shutil.copyfile('/var/task/ffmpeg.linux64', ffmpeg_bin)
os.chmod(ffmpeg_bin, 777)
# tried also:
# os.chmod(ffmpeg_bin, os.stat(ffmpeg_bin).st_mode | stat.S_IEXEC)
s3 = boto3.client('s3')
def get_thumb_filename(num):
return '{prefix}{num:03d}{ext}'.format(prefix=thumbnail_prefix, num=num, ext=thumbnail_ext)
def create_thumbnails(video_url):
i = 1
filenames_list = []
filename = None
while i == 1 or os.path.isfile(os.path.join(os.getcwd(), get_thumb_filename(i-1))):
if filename:
filenames_list.append(filename)
time = time_delta * (i - 1)
filename = get_thumb_filename(i)
print(ffmpeg_bin)
if os.path.isfile(ffmpeg_bin):
print('ok')
sp.call(['sudo',
ffmpeg_bin,
'-ss',
str(time),
'-i',
video_url,
'-frames:v',
'1',
get_thumb_filename(i)])
i += 1
print(filenames_list)
return filenames_list
def s3_upload_file(file_path, key, bucket, acl, content_type):
file = open(file_path, 'r')
s3.put_object(
Bucket=bucket,
ACL=acl,
Body=file,
Key=key,
ContentType=content_type
)
logger.info("file {0} moved to {1}/{2}".format(file_path, bucket, key))
def s3_upload_files_in_threads(filenames_list, dir_path, bucket, s3path, acl, content_type):
for filename in filenames_list:
if os.path.isfile(os.path.join(dir_path, filename)):
print(os.path.join(dir_path, filename))
t = threading.Thread(target=s3_upload_file,
args=(os.path.join(dir_path, filename),
'{0}/{1}'.format(s3path, filename),
bucket,
acl,
content_type)).start()
def lambda_handler(event, context):
bucket = event['Records'][0]['s3']['bucket']['name']
video_key = event['Records'][0]['s3']['object']['key']
video_name = video_key.split('/')[-1].split('.')[0]
video_url = 'http://{0}/{1}'.format(bucket, video_key)
filenames_list = create_thumbnails(video_url)
s3_upload_files_in_threads(filenames_list,
os.getcwd(),
bucket,
'{0}/{1}'.format(video_frames_path, video_name),
'public-read',
'image/jpeg')
returnduring the execution I get following logs :
Loading function
/tmp/ffmpeg.linux64
ok
[Errno 2] No such file or directory: OSError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 112, in lambda_handler
filenames_list = create_thumbnails(video_url)
File "/var/task/lambda_function.py", line 77, in create_thumbnails
get_thumb_filename(i)])
File "/usr/lib64/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directoryWhen I use the same sp.call() with the same ffmpeg binary on my ec2 instance it works fine.
-
Facebook LIVE with ffmpeg error - av_interleaved_write_frame() : Connection reset by peer
22 décembre 2016, par above14I’m trying to stream to Facebook a Live Video from an Amazon EC2 instance (c4.xlarge). I installed
ffmpeg
and stream with a command like the followingffmpeg -re -f concat -i /home/ec2-user/playlist.txt -f lavfi -re -i anullsrc=channel_layout=stereo:sample_rate=44100 -s 854x480 -c:a aac -strict -2 -ar 44100 -vcodec libx264 -f flv "{rtmp_link}"
Everything works fine. I had LIVE videos that worked for up to 2 days in a row. Sometimes, without a reason, I got one of these videos interrupted with this error message :
av_interleaved_write_frame(): Connection reset by peer
I haven’t been able to figure out a reason for this error yet. The funny thing is that maybe I have 3 streaming going on in the same machine at the same time, and just one of them get stopped by this message. Other times this error happens where there’s just one streaming on the EC2 instance.
Any ideas about how to find a solution ?
EDIT
We have installed a newer version of FFMPEG and the error now is more detailed. We have this message
RTMP send error 104
I haven’t found a lot about this issue online. Does someone know what error 104 means ?
-
ffmpeg transcode to live stream
14 septembre 2016, par brayancastropI need to display a ip camera stream in an html video tag, i have figured out how to transcode to a file from the rtsp stream like this
ffmpeg -i "rtsp://user:password@ip" -s 640x480 /tmp/output.mp4
now i need to be able to be able to live stream the rtsp input in a video tag like this
<video src="http://domain:port/output.mp4" autoplay="autoplay"></video>
I was trying to do something like this in my server (an ubuntu micro instance on amazon) in order to reproduce the video in the video tag but didn’t work
ffmpeg -i "rtsp://user:password@ip" -s 640x480 http://localhost:8080/stream.mp4
instead i got this log
[tcp @ 0x747b40] Connection to tcp://localhost:8080 failed: Connection refused
http://localhost:8080/stream.mp4: Connection refusedi don’t really understand what’s happening, not sure if it’s sending the output to that url or serving the output there and this, i’ve been checking the ffmpeg man docs but i didn’t find any example related to this use case and also other questiones like this one FFmpeg Stream Transcoding which is similar to my last try without success
btw, this is the camera i’m using DS-2CD2020F-I(W) - http://www.hikvision.com/en/Products_accessries_157_i5847.html
they offer an httppreview but it’s just an img tag source which updates but appears to be unstableThis is my first time trying to do something like this so any insight about how to achieve it will be really usefull and appreciated