
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (66)
-
L’espace de configuration de MediaSPIP
29 novembre 2010, parL’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
Il permet de configurer finement votre site.
La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (6606)
-
Pipe OpenCV and PyAudio to ffmpeg streaming youtube rtmp from python
22 août 2021, par a0910115172How can I pipe openCV and PyAudio to ffmpeg streaming youtube rtmp from python.
The error message shows as following :
No such filter : 'pipe:1'
pipe:1 : Invalid argument


Here is my code :


Import module


import cv2
import subprocess
import pyaudio



Audio


p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
 if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
 print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))

CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100

stream = p.open(format=FORMAT,
 channels=CHANNELS,
 rate=RATE,
 input=True,
 frames_per_buffer=CHUNK)

# Stream Audio data here
# data = stream.read(CHUNK)



Video


rtmp = r'rtmp://a.rtmp.youtube.com/live2/key'

cap = cv2.VideoCapture(0)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = 30




command param here


command = ['ffmpeg',
 '-y',
 '-f', 'rawvideo',
 '-pixel_format', 'bgr24',
 '-video_size', "{}x{}".format(width, height),
 '-framerate', str(fps),
 '-i', 'pipe:0',
 '-re',
 '-f', 'lavfi',
 '-i', 'pipe:1',
 '-c:v', 'libx264',
 '-c:a', 'aac',
 '-vf', 'format=yuv420p',
 '-f', 'flv',
 rtmp]



Create subprocess to ffmpeg command


pipe = subprocess.Popen(command, shell=False, stdin=subprocess.PIPE
)
while cap.isOpened():
 success, frame = cap.read()
 if success:
 if cv2.waitKey(1) & 0xFF == ord('q'):
 break
 pipe.stdin.write(frame.tostring())
 pipe.stdin.write(stream.read(CHUNK))



Audio Stop


stream.stop_stream()
stream.close()
p.terminate()



Video Stop


cap.release()
pipe.terminate()



Thanks


-
How to prevent screen tearing when updating stdin input to ffmpeg for youtube livestream
8 septembre 2021, par Cameron SimaI am working on a livestream application that allows multiple web clients to stream video through webrtc to a 'controller' client which will add their audio track, then be able to switch between these video feeds and output the raw stream data to a server running ffmpeg, which will then send the feed to youtube live.


The 'controller' client simply sets one peer video source as the 'active' stream on button press and all others as 'inactive'.


The data is then sent to a node.js server like so :


this.mediaSources.forEach((source, _) => {
 source.recorder.ondataavailable = (e: BlobEvent) => {
 if (source.active) {
 this.socket.emit('binarystream', e.data)
 }
 }



The node server starts an ffmepg process like so :


export class FfmpegService {
ffmpeg: ChildProcess
youtubeUrl = 'rtmp://a.rtmp.youtube.com/live2'

start(rtmpDestination: string) {
 this.ffmpeg = spawn('ffmpeg', this.getFfmpegOptions(rtmpDestination), 
 { shell: process.env.NODE_ENV !== 'production' }
 )
}

stop() {
 if (this.ffmpeg) {
 this.ffmpeg.stdin.end()
 this.ffmpeg.kill('SIGINT')
 this.ffmpeg = null
 }
}

feedStream(data: any) {
 this.ffmpeg.stdin.write(data)
}

private getFfmpegOptions(streamKey: string): string[] {
 const rtmpDestination = this.youtubeUrl + '/' + streamKey
 return [
 '-i','-',
 '-c:v', 'libx264', 
 '-preset', 'fast', '-tune', 'zerolatency', // video codec config: low latency, adaptive bitrate
 '-c:a', 'aac', '-ar', '44100', '-b:a', '64k', // audio codec config: sampling frequency (11025, 22050, 44100), bitrate 64 kbits
 '-y', //force to overwrite
 '-use_wallclock_as_timestamps', '1', // used for audio sync
 '-async', '1', // used for audio sync
 //'-filter_complex', 'aresample=44100', // resample audio to 44100Hz, needed if input is not 44100
 //'-strict', 'experimental', 
 '-bufsize', '300k',
 '-pix_fmt', 'yuv420p',
 '-f', 'flv', rtmpDestination
 ];
}



Everything works as expected in a youtube live session. The only problem is when switching between input streams, there is about 5 seconds of screen tearing before settling down. From all outward appearances, the switch happens immediately and seamlessly. I feel this can be attenuated/solved by tweaking the ffmpeg options but I'm pretty new to ffmpeg. I have tried increasing/decreasing -bufsize and -preset cli options, but nothing has worked so far.


-
Live stream prerecorded video to YouTube using FFMPEG with 4500 kbps bitrate
9 avril 2023, par RsanI tried various ways to make a live streaming script with a bit rate according to YouTube's recommendation of 4500 Kbps bit rate.
The code :


ffmpeg -re -stream_loop -1 -i live1.mp4 -c copy -preset veryfast -b:v 7000k -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv -flvflags no_duration_filesize rtmp://a.rtmp.youtube.com/live2/(streamkey)


and in my current code, there is an error when live : Use a keyframe frequency of four seconds or less. Currently, keyframes are sent infrequently which can cause buffering. The current keyframe frequency is 5.0 seconds. Please note that errors in the transfer process can cause the size of the GOP (group of images) to be incorrect.


How to fix my code ?


I've tried several ways, but the bit rate is still high, and the error is in YouTube Studio