
Recherche avancée
Autres articles (46)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (5672)
-
How do I combine PyTube audio and video streams in a Flask app and let the user download as one file without storing on the web server ?
10 avril 2022, par AJB9384I'm building a YouTube downloader as a side project in Flask. It allows users to input a url and download the video without storing anything on the server I'm hosting on


Lower quality videos can be sent to the user easily as they from PyTube as one file. I use the code below :


import os
import flask
from flask import redirect, url_for, session, send_file
import requests

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
 buffer=BytesIO()
 yt_test=YouTube('https://www.youtube.com/watch?v=NNNPgIfK2YE')
 video = yt_test.streams.get_by_itag(251)

 video.stream_to_buffer(buffer)
 buffer.seek(0)

 return send_file(buffer, as_attachment=True, download_name="Test video")



However, I struggle when trying to pull in higher quality videos as they come in as separate audio and videos streams (see documentation here : https://pytube.io/en/latest/user/streams.html#)


I am trying to use ffmpeg to combine the two and then send to the user, but the code below isn't working as expected and throws an error :


Code :


import os
import flask
from flask import redirect, url_for, session, send_file
import requests
import ffmpeg

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
 buffer=BytesIO()
 
 video = yt_test.streams.get_by_itag(137)
 input_video = ffmpeg.input(video)
 
 audio = yt_test.streams.get_by_itag(137)
 input_audio = ffmpeg.input(audio)
 
 combined = ffmpeg.concat(input_video, input_audio, v=1, a=1)
 combined.stream_to_buffer(buffer)
 buffer.seek(0)

 return send_file(buffer, as_attachment=True, download_name="Test video")



Error : AttributeError : 'FilterableStream' object has no attribute 'stream_to_buffer'


How could I combine these audio and video streams from PyTube into one file for the user to download without storing on the server ?


-
ffmpeg too long filter complex string
29 janvier 2018, par user2642511I have a video with an actor recorded with a green screen as background
I want to process that video with ffmpeg in order to have a diferent zooms of it every 3 seconds or every time there is a silence in the video and use chroma to replace the backbround of every 3 seconds section with a diferent background.
Well I made a program that charmly builds the entire filter string and tryed it with a 6 secods video and it works excelent.
But when I use it with a 2:30 minutes video the resultant string becames 6608 charracters long, aparently that is too long for command prompt to process it.
Well, aparently I have to change my strategy
What would you suggest in order to achieve what I want ?
My goal is :
Input green screen video ----> Process ----> Same video with diferent zooms and backgrounds every 3 seconds or every time the actor gets quiet
Thanks on advance
-
Powershell : Start-Job a script, cannot connect to youtube
16 mai 2016, par Kostas GeorgokitsosI am a bit new to PS, so please bear with me. I have written a script that starts an
ffmpeg
proccess, and in an endless loop waits for the process, and restarts it asffmpeg
is a bit shaky.ffmpeg
is taking an rtsp stream from a camera and forwards it to youtube.# initialization
$buffer_size = "30720k" # 60 sec * 512kbps
$ffm = "C:\Users\kostas\Downloads\_software\ffmpeg-20160308-git-5061579-win32-static\bin\ffmpeg.exe"
$params = "-f lavfi -i aevalsrc=0 -thread_queue_size 512 -i rtsp://$($usr):$($pw)@$($cam_ip):554/mpeg-4/ch1/main//av_stream/ -f flv -vcodec copy -acodec aac -bufsize $($buffer_size) rtmp://a.rtmp.youtube.com/live2/$($youtube_key)"
$params_bak = $params.Replace('/live2/','/live2/?backup=1/')
# start stream(s)
while (1 -eq 1) {
$err_log = "C:\Users\kostas\Documents\logs\Stream_Error-$(Get-Date -Format dd-MM-yyyy_HH-mm-ss).log"
$out_log = "C:\Users\kostas\Documents\logs\Stream-$(Get-Date -Format dd-MM-yyyy_HH-mm-ss).log"
$strm_app = Start-Process $ffm $params -PassThru -WindowStyle Minimized -RedirectStandardError $err_log -RedirectStandardOutput $out_log
Wait-Process $strm_app.Id
}When I call the script from the powershell prompt directly like
.\youtube_cam_1.ps1
all is well, but the powershell prompt locks, obviously.When I start like
Start-Job -FilePath C:\Users\kostas\Documents\youtube_cam_1.ps1
the job starts allright and I also see the ffmpeg process starting and running, but the youtube channel stays offline. Now to the funny bit : doingStop-Job
does not kill theffmpeg
process, and suddenlyffmpeg
can connect to youtube.I want to start and run several camera streams (i.e.
ffmpeg
instances) in the end and need the looping script to somehow go into the background. IsStart-Job
the wrong way to do it ?What is happening ?