
Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (71)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 (6176)
-
avcodec/hashtable : Remove null statement
3 juin, par Andreas Rheinhardt -
avutil/x86/pixelutils : Empty MMX state in ff_pixelutils_sad_8x8_mmxext
1er novembre 2023, par Andreas Rheinhardtavutil/x86/pixelutils : Empty MMX state in ff_pixelutils_sad_8x8_mmxext
We currently mostly do not empty the MMX state in our MMX
DSP functions ; instead we only do so before code that might
be using x87 code. This is a violation of the System V i386 ABI
(and maybe of other ABIs, too) :
"The CPU shall be in x87 mode upon entry to a function. Therefore,
every function that uses the MMX registers is required to issue an
emms or femms instruction after using MMX registers, before returning
or calling another function." (See 2.2.1 in [1])
This patch does not intend to change all these functions to abide
by the ABI ; it only does so for ff_pixelutils_sad_8x8_mmxext, as this
function can by called by external users, because it is exported
via the pixelutils API. Without this, the following fragment will
assert (on x86/x64) :
uint8_t src1[8 * 8], src2[8 * 8] ;
av_pixelutils_sad_fn fn = av_pixelutils_get_sad_fn(3, 3, 0, NULL) ;
fn(src1, 8, src2, 8) ;
av_assert0_fpu() ;[1] : https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-
Ffmpeg - transform mulaw 8000khz audio buffer data into valid bytes format
24 décembre 2023, par Bob LozanoI'm trying to read a bytes variable using ffmpeg, but the audio stream I listen to, sends me buffer data in mulaw encoded buffer like this :


https://github.com/boblp/mulaw_buffer_data/blob/main/buffer_data


I'm having trouble running the ffmpeg_read function from the transformers library found here :


def ffmpeg_read(bpayload: bytes, sampling_rate: int) -> np.array:
"""
Helper function to read an audio file through ffmpeg.
"""
ar = f"{sampling_rate}"
ac = "1"
format_for_conversion = "f32le"
ffmpeg_command = [
 "ffmpeg",
 "-i",
 "pipe:0",
 "-ac",
 ac,
 "-ar",
 ar,
 "-f",
 format_for_conversion,
 "-hide_banner",
 "-loglevel",
 "quiet",
 "pipe:1",
]

try:
 with subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) as ffmpeg_process:
 output_stream = ffmpeg_process.communicate(bpayload)
except FileNotFoundError as error:
 raise ValueError("ffmpeg was not found but is required to load audio files from filename") from error
out_bytes = output_stream[0]
audio = np.frombuffer(out_bytes, np.float32)
if audio.shape[0] == 0:
 raise ValueError(
 "Soundfile is either not in the correct format or is malformed. Ensure that the soundfile has "
 "a valid audio file extension (e.g. wav, flac or mp3) and is not corrupted. If reading from a remote "
 "URL, ensure that the URL is the full address to **download** the audio file."
 )
return audio



But everytime I get :


raise ValueError(
 "Soundfile is either not in the correct format or is malformed. Ensure that the soundfile has "
 "a valid audio file extension (e.g. wav, flac or mp3) and is not corrupted. If reading from a remote "
 "URL, ensure that the URL is the full address to **download** the audio file."
)



If I grab any wav file I can do something like this :


import wave

with open('./emma.wav', 'rb') as fd:
 contents = fd.read()
 print(contents)



And running it through the function does work !


So my question would be :


How can I transform my mulaw encoded buffer data into a valid bytes format that works with
ffmpeg_read()
?

EDIT : I've found a way using pywav (https://pypi.org/project/pywav/)


# 1 stands for mono channel, 8000 sample rate, 8 bit, 7 stands 
for MULAW encoding
wave_write = pywav.WavWrite("filename.wav", 1, 8000, 8, 7)
wave_write.write(mu_encoded_data)

wave_write.close()



This is the result : https://github.com/boblp/mulaw_buffer_data/blob/main/filename.wav


the background noise is acceptable.


However, I want to use a FFMPEG instead to avoid creating a tmp file.