
Recherche avancée
Médias (91)
-
Chuck D with Fine Arts Militia - No Meaning No
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Paul Westerberg - Looking Up in Heaven
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Le Tigre - Fake French
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Thievery Corporation - DC 3000
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Dan the Automator - Relaxation Spa Treatment
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Gilberto Gil - Oslodum
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (76)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
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" (...)
Sur d’autres sites (11773)
-
Title : Getting "invalid_request_error" when trying to pass converted audio file to OpenAI API
19 avril 2023, par Dummy CronI am working on a project where I receive a URL from a webhook on my server whenever users share a voice note on my WhatsApp. I am using WATI as my WhatsApp API Provder


The file URL received is in the .opus format, which I need to convert to WAV and pass to the OpenAI Whisper API translation task.


I am trying convert it to .wav using ffmpeg, and pass it to the OpenAI API for translation processing.
However, I am getting an "invalid_request_error"


import requests
import io
import subprocess
file_url = #.opus file url
api_key = #WATI API Keu

def transcribe_audio_to_text():
 # Fetch the audio file and convert to wav format

 headers = {'Authorization': f'Bearer {api_key}'}
 response = requests.get(file_url, headers=headers)
 audio_bytes = io.BytesIO(response.content)

 process = subprocess.Popen(['ffmpeg', '-i', '-', '-f', 'wav', '-acodec', 'libmp3lame', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 wav_audio, _ = process.communicate(input=audio_bytes.read())

 # Set the Whisper API endpoint and headers
 WHISPER_API_ENDPOINT = 'https://api.openai.com/v1/audio/translations'
 whisper_api_headers = {'Authorization': 'Bearer ' + WHISPER_API_KEY,
 'Content-Type': 'application/json'}
 print(whisper_api_headers)
 # Send the audio file for transcription

 payload = {'model': 'whisper-1'}
 files = {'file': ('audio.wav', io.BytesIO(wav_audio), 'audio/wav')}

 # files = {'file': ('audio.wav', io.BytesIO(wav_audio), 'application/octet-stream')}

 # files = {'file': ('audio.mp3', io.BytesIO(mp3_audio), 'audio/mp3')}
 response = requests.post(WHISPER_API_ENDPOINT, headers=whisper_api_headers, data=payload)
 print(response)
 # Get the transcription text
 if response.status_code == 200:
 result = response.json()
 text = result['text']
 print(response, text)
 else:
 print('Error:', response)
 err = response.json()
 print(response.status_code)
 print(err)
 print(response.headers)

transcribe_audio_to_text()



Output :


Error: <response>
400
{'error': {'message': "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please send an email to support@openai.com and include any relevant code you'd like help with.)", 'type': 'invalid_request_error', 'param': None, 'code': None}}
</response>


-
"Conversion failed !" when trying to write to frame to a rmtp stream
8 mai 2023, par Loc Bui NhienI'm trying to write video frames to an RTMP stream using FFMPEG and Python subsystem. The code will try to get videos in a 'ReceivedRecording' then it is stream to a RTMP streaming server using nginx. My method seems to work, but at times, the code will stop running due to


[flv @ 0x55b933694b40] Failed to update header with correct duration.
[flv @ 0x55b933694b40] Failed to update header with correct filesize.



and


Conversion failed


then


BrokenPipeError: [Errno 32] Broken pipe


Here my implementation of the task :


import subprocess
import cv2
rtmp_url = "rtmp://..."

path = 'ReceivedRecording'

received_video_path = 'ReceivedRecording'
while True:
 video_files = [filenames for filenames in sorted(
 os.listdir(received_video_path))]
 # Loop through the videos and concatenate them
 for filename in video_files[:len(video_files)-1]:
 video = cv2.VideoCapture(os.path.join(received_video_path, filename))

 if p is None:
 fps = int(video.get(cv2.CAP_PROP_FPS))
 width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
 height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
 # command and params for ffmpeg
 command = ['ffmpeg',
 '-y',
 '-f', 'rawvideo',
 '-vcodec', 'rawvideo',
 '-pix_fmt', 'bgr24',
 '-s', "{}x{}".format(width, height),
 '-re',
 '-r', '5',
 '-i', '-',
 # '-filter:v', 'setpts=4.0*PTS',
 '-c:v', 'libx264',
 '-pix_fmt', 'yuv420p',
 '-preset', 'ultrafast',
 '-tune','zerolatency',
 '-vsync','vfr',
 # '-crf','23',
 '-f', 'flv',
 rtmp_url]
 
 # using subprocess and pipe to fetch frame data
 p = subprocess.Popen(command, stdin=subprocess.PIPE)
 else:

 # Loop through the frames of each video
 while True:
 start_time = time.time()

 ret, frame = video.read()
 if not ret:
 # End of video, move to next video
 video.release()
 break

 p.stdin.write(frame.tobytes())

 os.remove(os.path.join(received_video_path, filename))



Here is my nginx rtmp settings :


rtmp {
 server {
 listen 1935;
 chunk_size 7096;

 application live {
 live on;
 record off;
 push rtmp://...;
 }
 }
}



Here is the log file :


av_interleaved_write_frame(): Connection reset by peer
No more output streams to write to, finishing.
[flv @ 0x5561d1ca9b40] Failed to update header with correct duration.
[flv @ 0x5561d1ca9b40] Failed to update header with correct filesize.
Error writing trailer of rtmp://...: Connection reset by peer
frame= 1 fps=0.0 q=20.0 Lsize= 1024kB time=00:00:00.00 bitrate=8390776.0kbits/s speed=0.00619x
video:1053kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (pipe:):
 Input stream #0:0 (video): 1 packets read (11059200 bytes); 1 frames decoded;
 Total: 1 packets (11059200 bytes) demuxed
Output file #0 (rtmp://...):
 Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (1077799 bytes);
 Total: 1 packets (1077799 bytes) muxed
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x5561d1cad380] Statistics: 0 seeks, 35 writeouts
[rtmp @ 0x5561d1cb7b80] Deleting stream...
[libx264 @ 0x5561d1caae40] frame I:1 Avg QP:20.00 size:1077192
[libx264 @ 0x5561d1caae40] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x5561d1caae40] coded y,uvDC,uvAC intra: 92.2% 50.5% 10.2%
[libx264 @ 0x5561d1caae40] i16 v,h,dc,p: 34% 16% 37% 12%
[libx264 @ 0x5561d1caae40] i8c dc,h,v,p: 35% 23% 33% 9%
[libx264 @ 0x5561d1caae40] kb/s:43087.68
[AVIOContext @ 0x5561d1ca6a80] Statistics: 11059200 bytes read, 0 seeks
Conversion failed!



-
Is there a way to cut movement "dead air" on a screen recording ? [closed]
16 mai 2023, par RaelbeI have got a couple of screen recordings of a painting I've done, and I've managed to concat the files together.


Unfortunately, there is a lot of "dead air" in the video (where I have left my desk, so there is no movement happening on screen) is there a way to cut out this down time ?


I found an example that another artist uses for his screen recordings, so I plugged it in with my file directory's. This is what I used :


.\ffmpeg -f concat -safe 0 -i "merge.txt" -vf npdecimate=hi=64*12:lo=64*5:frac=0.33,seipts=N/30/TB,"setpts=0.25*PTS" -r 30 -crf 30 -an Illu_Test.mp4



I got this error message at the end :


[AVFilterGraph @ 000001cadfe5b1c0] No option name near 'N/30/TB'
[AVFilterGraph @ 000001cadfe5b1c0] Error parsing a filter description around: ,setpts=0.25*PTS
[AVFilterGraph @ 000001cadfe5b1c0] Error parsing filterchain 'npdecimate=hi=64*12:lo=64*5:frac=0.33,seipts=N/30/TB,setpts=0.25*PTS' around: ,setpts=0.25*PTS
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0`



So I chopped it up a bit and this is what I used to concat the files and it worked perfectly.


.\ffmpeg -f concat -safe 0 -i "merge.txt" -crf 30 -an Illu_Test.mp4



Now, I'm looking to cut out the seconds of no movement. I'm unsure what the -crf command does (as stated I am brand new to this) OG artist states that :


"This is the tolerance level that determines whether there has been enough change between frames or not to be considered as detected motion."


Any help would be appreciated.


(Apologies if the format of this question is wrong)