Advanced search

Medias (1)

Tag: - Tags -/lev manovitch

Other articles (48)

  • Les autorisations surchargées par les plugins

    27 April 2010, by

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Le plugin : Podcasts.

    14 July 2010, by

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 video/mp4 (...)

  • Organiser par catégorie

    17 May 2013, by

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

On other websites (7306)

  • doc/filters/crop: drop unmatched quote in example

    11 May 2023, by Andriy Utkin
    doc/filters/crop: drop unmatched quote in example
    

    Commit 55b81528a991 ("doc/filters: itemize crop examples") dropped the
    quotation marks from these examples, but this one remained. Quotes are
    actually needed to put the example into a command line or a program, but
    removing it here makes the example consistent with the document.

    • [DH] doc/filters.texi
  • Title: Getting "invalid_request_error" when trying to pass converted audio file to OpenAI API

    19 April 2023, by Dummy Cron

    I 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>&#xA;400&#xA;{&#x27;error&#x27;: {&#x27;message&#x27;: "We could not parse the JSON body of your request. (HINT: This likely means you aren&#x27;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&#x27;d like help with.)", &#x27;type&#x27;: &#x27;invalid_request_error&#x27;, &#x27;param&#x27;: None, &#x27;code&#x27;: None}}&#xA;</response>

    &#xA;

  • choosing outbound IP (eth0 or eth1) in FFMPEG

    4 September 2018, by Ba Ta

    I have 2 IP addresses on my server.

    $curl --interface eth0 ifconfig.co      
    111.111.111.111

    $curl --interface eth0:0 ifconfig.co      
    222.222.222.222

    So via curl I can switch via interfaces so my IP address changes when I visit any url based on eth IP

    How can I use same thing via ffmpeg?

    For example, if want to access this video via ffmpeg (it uses 111.111.111.111 to access it)

    ffmpeg -i 123.com/video.mp4

    how can I access same video from my second IP 222.222.222.222 ?

    Is there any command like this, perhaps?

    ffmpeg --interface eth0:0  -i 123.com/video.mp4