
Recherche avancée
Autres articles (15)
-
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (4123)
-
Android-FFmpeg adding subtitle to mp4 video does not work
7 septembre 2022, par ebdaa appI am trying to add srt file to a mp4 video using android mobile-ffmpeg , the code works with no error but the generated video does not contain the subtitle


here is the code :


String cmd = "-i " + videoPath + " -vf subtitles=\"" + subtitlePath + ":force_style='Alignment=10,Fontsize=18'\" " + OutputVideoPath;
 FFmpeg.executeAsync(cmd, new ExecuteCallback() {
 @Override
 public void apply(final long executionId, final int returnCode) {
 if (returnCode == RETURN_CODE_SUCCESS) {
 } else {
 
 }
 }
 });



here are the logs


I/mobile-ffmpeg: ffmpeg version v4.4-dev-416
 Copyright (c) 2000-2020 the FFmpeg developers
I/mobile-ffmpeg: built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
 configuration: --cross-prefix=arm-linux-androideabi- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm/neon/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=armv7-a --cpu=armv7-a --cc=armv7a-linux-androideabi24-clang --cxx=armv7a-linux-androideabi24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm/neon/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --build-suffix=_neon --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
I/mobile-ffmpeg: libavutil 56. 55.100 / 56. 55.100
 libavcodec 58. 96.100 / 58. 96.100
I/mobile-ffmpeg: libavformat 58. 48.100 / 58. 48.100
 libavdevice 58. 11.101 / 58. 11.101
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
I/mobile-ffmpeg: libswresample 3. 8.100 / 3. 8.100
I/mobile-ffmpeg: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Download/7b85de4d-6af2-4eea-be9d-0d13c7f7819f/001001.mp4':
 Metadata:
 major_brand : 
I/mobile-ffmpeg: isom
 minor_version : 
I/mobile-ffmpeg: 512
 compatible_brands: 
I/mobile-ffmpeg: isomiso2mp41
I/mobile-ffmpeg: encoder : 
 Lavf58.48.100
I/mobile-ffmpeg: Duration: 
 00:00:29.60
 , start: 
I/mobile-ffmpeg: 0.000000
 , bitrate: 
 466 kb/s
I/mobile-ffmpeg: Stream #0:0
 (und)
I/mobile-ffmpeg: : Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:2 DAR 2:3], 336 kb/s
 , 
 5 fps, 
I/mobile-ffmpeg: 5 tbr, 
 10240 tbn, 
 5 tbc
I/mobile-ffmpeg: (default)
I/mobile-ffmpeg: Metadata:
 handler_name : 
 VideoHandler
I/mobile-ffmpeg: Stream #0:1
I/mobile-ffmpeg: (und)
 : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
 (default)
I/mobile-ffmpeg: Metadata:
I/mobile-ffmpeg: handler_name : 
 SoundHandler
W/mobile-ffmpeg: Codec AVOption preset (Configuration preset) specified for output file #0 (/storage/emulated/0/Download/QuranYaser/7b85de4d-6af2-4eea-be9d-0d13c7f7819f/001001_sub.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
I/mobile-ffmpeg: Stream mapping:
I/mobile-ffmpeg: Stream #0:0 -> #0:0
I/mobile-ffmpeg: (mpeg4 (native) -> mpeg4 (native))
I/mobile-ffmpeg: Stream #0:1 -> #0:1
 (aac (native) -> aac (native))
I/mobile-ffmpeg: Press [q] to stop, [?] for help
 frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A 
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0xf35ee820] Shaper: FriBidi 1.0.9 (SIMPLE)
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0xf35ee820] 
W/mobile-ffmpeg: [Parsed_subtitles_0 @ 0xf35ee820] No usable fontconfig configuration file found, using fallback.
 [Parsed_subtitles_0 @ 0xf35ee820] 
I/mobile-ffmpeg: [Parsed_subtitles_0 @ 0xf35ee820] Using font provider fontconfig
 [Parsed_subtitles_0 @ 0xf35ee820] 
W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0xf35ee880] sws_param option is deprecated and ignored
I/mobile-ffmpeg: Output #0, mp4, to '/storage/emulated/0/Download/QuranYaser/7b85de4d-6af2-4eea-be9d-0d13c7f7819f/001001_sub.mp4':
I/mobile-ffmpeg: Metadata:
 major_brand : 
 isom
I/mobile-ffmpeg: minor_version : 
 512
I/mobile-ffmpeg: compatible_brands: 
I/mobile-ffmpeg: isomiso2mp41
 encoder : 
I/mobile-ffmpeg: Lavf58.48.100
 Stream #0:0
I/mobile-ffmpeg: (und)
 : Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:2 DAR 2:3], q=2-31, 200 kb/s
 , 
I/mobile-ffmpeg: 5 fps, 
I/mobile-ffmpeg: 10240 tbn, 
 5 tbc
I/mobile-ffmpeg: (default)
 Metadata:
I/mobile-ffmpeg: handler_name : 
 VideoHandler
 encoder : 
I/mobile-ffmpeg: Lavc58.96.100 mpeg4
 Side data:
I/mobile-ffmpeg: 
 cpb: 
 bitrate max/min/avg: 0/0/200000 buffer size: 0 
 vbv_delay: N/A
I/mobile-ffmpeg: Stream #0:1
 (und)
I/mobile-ffmpeg: : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
 (default)
 Metadata:
I/mobile-ffmpeg: handler_name : 
 SoundHandler
I/mobile-ffmpeg: encoder : 
 Lavc58.96.100 aac
I/mobile-ffmpeg: frame= 11 fps=0.0 q=2.0 size= 0kB time=00:00:03.59 bitrate= 0.1kbits/s speed=7.16x 
I/mobile-ffmpeg: frame= 30 fps= 30 q=2.0 size= 256kB time=00:00:07.47 bitrate= 280.5kbits/s speed=7.44x 
I/mobile-ffmpeg: frame= 50 fps= 33 q=2.0 size= 512kB time=00:00:11.54 bitrate= 363.5kbits/s speed=7.67x 
I/mobile-ffmpeg: frame= 71 fps= 35 q=2.0 size= 768kB time=00:00:15.71 bitrate= 400.2kbits/s speed=7.83x 
I/mobile-ffmpeg: frame= 92 fps= 37 q=2.0 size= 1024kB time=00:00:19.78 bitrate= 424.0kbits/s speed=7.88x 
I/mobile-ffmpeg: frame= 110 fps= 36 q=2.0 size= 1280kB time=00:00:23.38 bitrate= 448.5kbits/s speed=7.75x 
I/mobile-ffmpeg: frame= 128 fps= 36 q=2.0 size= 1280kB time=00:00:27.12 bitrate= 386.6kbits/s speed=7.71x 
I/mobile-ffmpeg: frame= 148 fps= 38 q=8.4 Lsize= 1697kB time=00:00:29.40 bitrate= 472.9kbits/s speed=7.56x 
 video:1225kB audio:462kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
I/mobile-ffmpeg: 0.559634%
I/mobile-ffmpeg: [aac @ 0xbe48c800] Qavg: 163.999



here is a sample of srt file I am trying to merge :


1
00:00:00,000 --> 00:00:03,326
 Text 1

2
00:00:03,326 --> 00:00:09,962
 Text 2

3
00:00:09,962 --> 00:00:16,160
 Text 3

4
00:00:16,160 --> 00:00:22,223
 Text 4



any idea why the generated video does not contain the subtitle ?


Update


Based on below comment , I changed my code to use the latest ffmpeg-kit version , here is the new code


String cmd = "-i " + videoPath + " -vf subtitles=\"" + subtitlePAth + ":force_style='Alignment=10,Fontsize=18\" " + 
 outputVideoPath;

 FFmpegKit.executeAsync(cmd, new FFmpegSessionCompleteCallback() {

 @Override
 public void apply(FFmpegSession session) {

 }
 }, new LogCallback() {

 @Override
 public void apply(com.arthenica.ffmpegkit.Log log) {


 }
 }, new StatisticsCallback() {

 @Override
 public void apply(Statistics statistics) { 

 }
 });`



and here is the updated log


ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers
 built with Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
 configuration: --cross-prefix=arm-linux-androideabi- --sysroot=/files/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/storage/light/projects/ffmpeg-kit/prebuilt/android-arm-neon/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=armv7-a --cpu=armv7-a --target-os=android --enable-neon --enable-asm --enable-inline-asm --build-suffix=_neon --ar=arm-linux-androideabi-ar --cc=armv7a-linux-androideabi24-clang --cxx=armv7a-linux-androideabi24-clang++ --ranlib=arm-linux-androideabi-ranlib --strip=arm-linux-androideabi-strip --nm=arm-linux-androideabi-nm --extra-libs='-L/storage/light/projects/ffmpeg-kit/prebuilt/android-arm-neon/cpu-features/lib -lndk_compat' --disable-autodetect --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --disable-static --enable-shared --enable-pthreads --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libdav1d --enable-libkvazaar --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-libzimg --disable-openssl --enable-zlib --enable-mediacodec
 libavutil 57. 13.100 / 57. 13.100
 libavcodec 59. 15.102 / 59. 15.102
 libavformat 59. 10.100 / 59. 10.100
 libavdevice 59. 1.100 / 59. 1.100
 libavfilter 8. 21.100 / 8. 21.100
 libswscale 6. 1.102 / 6. 1.102
 libswresample 4. 0.100 / 4. 0.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Download/7b85de4d-6af2-4eea-be9d-0d13c7f7819f/001001.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf59.10.100
 Duration: 00:00:29.60, start: 0.000000, bitrate: 467 kb/s
 Stream #0:0[0x1](und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, bt470bg/bt709/bt709), 640x480 [SAR 1:2 DAR 2:3], 336 kb/s, 5 fps, 5 tbr, 10240 tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
 [mpeg4 @ 0xbacc1080] The "sub_text_format" option is deprecated: Deprecated, does nothing
 [aac @ 0xbacc1400] The "sub_text_format" option is deprecated: Deprecated, does nothing
 Stream mapping:
 Stream #0:0 -> #0:0 (mpeg4 (native) -> mpeg4 (native))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
 Press [q] to stop, [?] for help
 [Parsed_subtitles_0 @ 0xf35141e0] libass API version: 0x1502000[Parsed_subtitles_0 @ 0xf35141e0] 
 [Parsed_subtitles_0 @ 0xf35141e0] libass source: commit: 0.15.2-0-gc967a5a3d9ec0d36af1148b3fdf2f307a21dd122[Parsed_subtitles_0 @ 0xf35141e0] 
 [Parsed_subtitles_0 @ 0xf35141e0] Shaper: FriBidi 1.0.11 (SIMPLE) HarfBuzz-ng 3.2.0 (COMPLEX)[Parsed_subtitles_0 @ 0xf35141e0] 
 [Parsed_subtitles_0 @ 0xf35141e0] No usable fontconfig configuration file found, using fallback.[Parsed_subtitles_0 @ 0xf35141e0] 
 [Parsed_subtitles_0 @ 0xf35141e0] Using font provider fontconfig[Parsed_subtitles_0 @ 0xf35141e0] 
 [Parsed_subtitles_0 @ 0xf35141e0] fontselect: failed to find any fallback with glyph 0x0 for font: (Arial, 400, 0)[Parsed_subtitles_0 @ 0xf35141e0] 
 Output #0, mp4, to '/storage/emulated/0/Download/7b85de4d-6af2-4eea-be9d-0d13c7f7819f/001001_sub5.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf59.10.100
 Stream #0:0(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, bt470bg/bt709/bt709, progressive), 640x480 [SAR 1:2 DAR 2:3], q=2-31, 200 kb/s, 5 fps, 10240 tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.15.102 mpeg4
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.15.102 aac
 frame= 1 fps=0.0 q=5.7 size= 0kB time=00:00:01.55 bitrate= 0.2kbits/s speed= 2.4x 
 frame= 10 fps=8.7 q=2.0 size= 0kB time=00:00:03.50 bitrate= 0.1kbits/s speed=3.04x 
 frame= 20 fps= 12 q=2.0 size= 0kB time=00:00:05.36 bitrate= 0.1kbits/s speed=3.24x 
 frame= 32 fps= 15 q=2.0 size= 256kB time=00:00:07.87 bitrate= 266.5kbits/s speed=3.65x 
 frame= 45 fps= 17 q=2.0 size= 256kB time=00:00:10.49 bitrate= 199.8kbits/s speed=3.95x 
 frame= 58 fps= 18 q=2.0 size= 512kB time=00:00:12.97 bitrate= 323.2kbits/s speed=4.11x 
 frame= 69 fps= 19 q=2.0 size= 768kB time=00:00:15.23 bitrate= 413.1kbits/s speed=4.16x 
 frame= 81 fps= 19 q=2.0 size= 768kB time=00:00:17.60 bitrate= 357.5kbits/s speed=4.23x 
 frame= 92 fps= 20 q=2.0 size= 1024kB time=00:00:19.85 bitrate= 422.6kbits/s speed=4.26x 
 frame= 102 fps= 20 q=2.0 size= 1024kB time=00:00:21.89 bitrate= 383.1kbits/s speed=4.24x 
 frame= 115 fps= 20 q=2.0 size= 1280kB time=00:00:24.40 bitrate= 429.7kbits/s speed=4.31x 
 frame= 126 fps= 20 q=2.0 size= 1280kB time=00:00:26.67 bitrate= 393.0kbits/s speed=4.32x 
 frame= 139 fps= 21 q=2.0 size= 1536kB time=00:00:29.28 bitrate= 429.8kbits/s speed=4.39x 
 frame= 148 fps= 22 q=8.4 Lsize= 1701kB time=00:00:29.40 bitrate= 473.9kbits/s speed=4.34x 
 video:1225kB audio:466kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.561835%
 [aac @ 0xbacc2200] Qavg: 482.514



-
FFMPEG command from Python 3.5 does not actually create audio file
20 décembre 2017, par Nathan BlaineI have a Django web application that accepts user uploaded videos/audio and saves them into a folder ’../WebAppDirectory/media/recordings’.
I am then using a speech to text API to get a rough transcription of the audio. This is working fine for .wav and .mp4 files, but the web app also accepts videos (.MOV) that I would like to first convert to .wav, then pass off to the API.
Using ffmpeg from my command line like this
ffmpeg -i C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\media\recordings\upload_sample.MOV -ab 160k -ac 2 -ar 44100 -vn upload_sample.wav
Correctly creates the .wav file from the original .MOV.
However, when I run this from python with
subprocess.check_call(command, shell=True)
ffmpeg responds with
File ’upload_sample.wav’ already exists. Overwrite ? [y/N]
While Python tells me
FileNotFoundError : [Errno 2] No such file or directory : ’C :\Users\Nathan\Desktop\MeetingRecorderWebAPP\media\recordings\upload_sample.wav’
It is also worth noting that I do not see a ’upload_sample.wav’ file in the media/recordings/ directory.
This leads me to believe that maybe Python and ffmpeg are looking in different folders, but I am not sure where I am going wrong. When I print the command from the subprocess.check_call and copy/paste it into cmd, the file is created as expected.
Hoping someone with some experience with ffmpeg/Python subprocess can help shed some light ! Here are the files I am working with :
Folder Structure
DjangoWebApp
|---media
|---|---imgs
|---|---recordings
|---|---|---upload_sample.MOV
|---uploaded_audio_to_text.pyuploaded_audio_to_text.py
import speech_recognition as sr
from os import path
import os
import subprocess
def speech_to_text(file_name):
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), 'media','recordings', file_name)
print("Looking at path: ",AUDIO_FILE)
# get extension
AUDIO_FILE_EXT = os.path.splitext(AUDIO_FILE)[1]
if(AUDIO_FILE_EXT == '.MOV'):
print("File is not .wav: ", AUDIO_FILE_EXT, "found. Converting...")
# We will use subprocess and ffmpeg to convert this .MOV file to .wav, so we can send to API
temp_wav = os.path.splitext(file_name)[0] + '.wav'
print("New audio file will be: ", temp_wav)
# build CMD ffmpeg command
command = "ffmpeg -i "
command += AUDIO_FILE
command += " -ab 160k -ac 2 -ar 44100 -vn "
command += temp_wav
print("Attempting to run this command: \n",command)
print(subprocess.check_call(command, shell=True))
print("Past Subprocess.call")
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), 'media','recordings', temp_wav)
print("AUDIO_FILE now set to: ", AUDIO_FILE)
else:
# continue with what we are doing
pass
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
text_transcription = "Sentinel"
# recognize speech using Microsoft Bing Voice Recognition
BING_KEY = "MY_KEY_:)"
try:
text_transcription = r.recognize_bing(audio, key=BING_KEY)
except sr.UnknownValueError:
print("Microsoft Bing Voice Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Microsoft Bing Voice Recognition service; {0}".format(e))
return text_transcription
#my tests
my_relative_file_path = "upload_sample.MOV"
print(speech_to_text(my_relative_file_path))Console output (traceback and my print()’s)
Looking at path: C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\media\recordings\upload_sample.MOV
File is not .wav: .MOV found. Converting...
New audio file will be: upload_sample.wav Attempting to run this command:
ffmpeg -i C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\media\recordings\upload_sample.MOV -ab 160k -ac 2 -ar 44100 -vn upload_sample.wav
ffmpeg version git-2017-12-18-74f408c Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC)
----REMOVED SOME FFMPEG OUTPUT FOR BREVITY----
File 'upload_sample.wav' already exists. Overwrite ? [y/N] y
Stream mapping: Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help Output #0, wav, to 'upload_sample.wav': Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
com.apple.quicktime.creationdate: 2017-12-19T16:06:10-0500
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6
com.apple.quicktime.software: 10.3.3
ISFT : Lavf58.3.100
Stream #0:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s (default)
Metadata:
creation_time : 2017-12-19T21:06:11.000000Z
handler_name : Core Media Data Handler
encoder : Lavc58.8.100 pcm_s16le size= 1036kB time=00:00:06.01 bitrate=1411.3kbits/s speed=N/A video:0kB audio:1036kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.007352%
0
Traceback (most recent call last): Past Subprocess.call
File "C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\uploaded_audio_to_text.py", line 53, in <module>
AUDIO_FILE now set to: C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\media\recordings\upload_sample.wav
print(speech_to_text(my_relative_file_path))
File "C:\Users\Nathan\Desktop\MeetingRecorderWebAPP\uploaded_audio_to_text.py", line 36, in speech_to_text
with sr.AudioFile(AUDIO_FILE) as source:
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\speech_recognition\__init__.py", line 203, in __enter__
self.audio_reader = wave.open(self.filename_or_fileobject, "rb")
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python36-32\lib\wave.py", line 499, in open
return Wave_read(f)
File "C:\Users\Nathan\AppData\Local\Programs\Python\Python36-32\lib\wave.py", line 159, in __init__
f = builtins.open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Nathan\\Desktop\\MeetingRecorderWebAPP\\media\\recordings\\upload_sample.wav'
Process finished with exit code 1
</module> -
My SBC Collection
31 décembre 2023, par Multimedia Mike — GeneralLike many computer nerds in the last decade, I have accumulated more than a few single-board computers, or “SBCs”, which are small computers based around a system-on-a-chip (SoC) that nearly always features an ARM CPU at its core. Surprisingly few of these units are Raspberry Pi units, though that brand has come to exemplify and dominate the product category.
Also, as is the case for many computer nerds, most of these SBCs lay fallow for years at a time. Equipped with an inexpensive lightbox that I procured in the last year, I decided I could at least create glamour shots of various units and catalog them in a blog post.
While Raspberry Pi still enjoys the most mindshare far and away, and while I do have a few Raspberry Pi units in my inventory, I have always been a bigger fan of the ODROID brand, which works with convenient importers around the world (in the USA, I can vouch for Ameridroid, to whom I’ve forked over a fair amount of cash for these computing toys).
As mentioned, Raspberry Pi undisputedly has the most mindshare of all these SBC brands and I often wonder why… and then I immediately remind myself that it has the biggest ecosystem, and has a variety of turnkey projects and applications (such as Pi-hole and PiVPN) that promise a lower barrier to entry — as well as a slightly lower price point — than some of these other options. ODROID had a decent ecosystem for awhile, especially considering the monthly ODROID Magazine, though that ceased publication in July 2020. The Raspberry Pi and its variants were famously difficult to come by due to the global chip shortage from 2021-2023. Meanwhile, I had no trouble procuring these boards during the same timeframe.
So let’s delve into the collection…
Cubieboard
The Raspberry Pi came out in 2012 and by 2013 I was somewhat coveting one to hack on. Finally ! An accessible ARM platform to play with. I had heard of the BeagleBoard for years but never tried to get my hands on one. I was thinking about taking the plunge on a new Raspberry Pi, but a colleague told me I should skip that and go with this new hotness called the Cubieboard, based on an Allwinner SoC. The big value-add that this board had vs. a Raspberry Pi was that it had a SATA adapter. Although now that it has been a decade, it only now occurs to me to quander whether it was true SATA or a USB-to-SATA bridge. Looking it up now, I’m led to believe that the SoC supported the functionality natively.Anyway, I did get it up and running but never did much with it, thus setting the tone for future SBC endeavors. No photos because I gave it to another tech enthusiast years ago, whose SBC collection dwarfs my own.
ODROID-XU4
I can’t recall exactly when or how I first encountered the ODROID brand. I probably read about it on some enthusiast page or another circa 2014 and decided to try one out. I eventually acquired a total of 3 of these ODROID-XU4 units, each with a different case, 1 with a fan and 2 passively-cooled :This is based on the Samsung Exynos 5422 SoC, the same series as was used in their Note 3 phone released in 2013. It has been a fun chip to play with. The XU4 was also my first introduction to the eMMC storage solution that is commonly supported on the ODROID SBCs (alongside micro-SD). eMMC offers many benefits over SD in terms of read/write speed as well as well as longevity/write cycles. That’s getting less relevant these days, however, as more and more SBCs are being released with direct NVMe SSD support.
I had initially wanted to make a retro-gaming device built on this platform (see the handheld section later for more meditations on that). In support of this common hobbyist goal, there is this nifty case XU4 case which apes the aesthetic of the Nintendo N64 :
It even has a cool programmable LCD screen. Maybe one day I’ll find a use for it.
For awhile, one of these XU4 units (likely the noisy, fan-cooled one) was contributing results to the FFmpeg FATE system.
While it features gigabit ethernet and a USB3 port, I once tried to see if I could get 2 Gbps throughput with the unit using a USB3-gigabit dongle. I had curious results in that the total amount of traffic throughput could never exceed 1 Gbps across both interfaces. I.e., if 1 interface was dealing with 1 Gbps and the other interface tried to run at 1 Gbps, they would both only run at 500 Mbps. That remains a mystery to me since I don’t see that limitation with Intel chips.
Still, the XU4 has been useful for a variety of projects and prototyping over the years.
ODROID-HC2 NAS
I find that a lot of my fellow nerds massively overengineer their homelab NAS setups. I’ll explore this in a future post. For my part, people tend to find my homelab NAS solution slightly underengineered. This is the ODROID-HC2 (the “HC” stands for “Home Cloud”) :It has the same guts as the ODROID-XU4 except no video output and the USB3 function is leveraged for a SATA bridge. This allows you to plug a SATA hard drive directly into the unit :
Believe it or not, this has been my home NAS solution for something like 6 or 7 years now– I don’t clearly remember when I purchased it and put it into service.
But isn’t this sort of irresponsible ? What about a failure of the main drive ? That’s why I have an external drive connected for backing up the most important data via rsync :
The power consumption can’t be beat– Profiling for a few weeks of average usage worked out to 4.5 kWh for the ODROID-HC2… per month.
ODROID-C2
I was on a kick of ordering more SBCs at one point. This is the ODROID-C2, equipped with a 64-bit Amlogic SoC :I had this on the FATE farm for awhile, performing 64-bit ARM builds (vs. the XU4’s 32-bit builds). As memory serves, it was unreliable and would occasionally freeze up.
Here is a view of the eMMC storage through the bottom of the translucent case :
ODROID-N2+
Out of all my ODROID SBCs, this is the unit that I long to “get back to” the most– the ODROID-N2+ :Very capable unit that makes a great little desktop. I have some projects I want to develop using it so that it will force me to have a focused development environment.
Raspberry Pi
Eventually, I did break down and get a Raspberry Pi. I had a specific purpose in mind and, much to my surprise, I have stuck to it :I was using one of the ODROID-XU4 units as a VPN gateway. Eventually, I wanted to convert the XU4 to something else and I decided to run the VPN gateway as an appliance on the simplest device I could. So I procured this complete hand-me-down unit from eBay and went to work. This was also the first time I discovered the DietPi distribution and this box has been in service running Wireguard via PiVPN for many years.
I also have a Raspberry Pi 3B+ kicking around somewhere. I used it as a Steam Link device for awhile.
SOPINE + Baseboard
Also procured when I was on this “let’s buy random SBCs” kick. The Pine64 SOPINE is actually a compute module that comes in the form factor of a memory module.Back to using Allwinner SoCs. In order to make this thing useful, you need to place it in something. It’s possible to get a mini-ITX form factor board that can accommodate 7 of these modules. Before going to that extreme, there is this much simpler baseboard which can also use eMMC for storage.
I really need to find an appropriate case for this one as it currently performs its duty while sitting on an anti-static bag.
NanoPi NEO3
I enjoy running the DietPi distribution on many of these SBCs (as it’s developed not just for Raspberry Pi). I have also found their website to be a useful resource for discovering new SBCs. That’s how I found the NanoPi series and zeroed in on this NEO3 unit, sporting a Rockchip SoC, and photographed here with some American currency in order to illustrate its relative size :I often forget about this computer because it’s off in another room, just quietly performing its assigned duty.
MangoPi MQ-Pro
So far, I’ve heard of these fruits prepending the Greek letter pi for naming small computing products :- Raspberry – the O.G.
- Banana – seems to be popular for hobbyist router/switches
- Orange
- Atomic
- Nano
- Mango
Okay, so the AtomicPi and NanoPi names don’t really make sense considering the fruit convention.
Anyway, the newest entry is the MangoPi. These showed up on Ameridroid a few months ago. There are 2 variants : the MQ-Pro and the MQ-Quad. I picked one and rolled with it.
When it arrived, I unpacked it, assembled the pieces, downloaded a distro, tossed that on a micro-SD card, connected a monitor and keyboard to it via its USB-C port, got the distro up and running, configured the wireless networking with a static IP address and installed sshd, and it was ready to go as a headless server for an edge application.
The unit came with no instructions that I can recall. After I got it set up, I remember thinking, “What is wrong with me ? Why is it that I just know how to do all of this without any documentation ?”
Only after I got it up and running and poked around a bit did I realize that this SBC doesn’t have an ARM SoC– it’s a RISC-V SoC. It uses the Allwinner D1, so it looks like I came full circle back to Allwinner.
So I now have my first piece of RISC-V hobbyist kit, although I learned recently from Kostya that it’s not that great for multimedia.
Handheld Gaming Units
The folks at Hardkernel have also produced a series of handheld retro-gaming devices called ODROID-GO. The first one resembled the original Nintendo Game Boy, came as a kit to be assembled, and emulated 5 classic consoles. It also had some hackability to it. Quite a cool little device, and inexpensive too. I have since passed it along to another gaming enthusiast.Later came the ODROID-GO Advance, also a kit, but emulating more devices. I was extremely eager to get my hands on this since it could emulate SNES in addition to NES. It also features a headphone jack, unlike the earlier model. True to form, after I received mine, it took me about 13 months before I got around to assembling it. After that, the biggest challenge I had was trying to find an appropriate case for it.
Even though it may try to copy the general aesthetic and form factor of the Game Boy Advance, cases for the GBA don’t fit this correctly.
Further, Hardkernel have also released the ODROID-GO Super and Ultra models that do more and more. The Advance, Super, and Ultra models have powerful SoCs and feature much more hackability than the first ODROID-GO model.
I know that the guts of the Advance have been used in other products as well. The same is likely true for the Super and Ultra.
Ultimately, the ODROID-GO Advance was just another project I assembled and then set aside since I like the idea of playing old games much more than actually doing it. Plus, the fact has finally crystalized in my mind over the past few years that I have never enjoyed handheld gaming and likely will never enjoy handheld gaming, even after I started wearing glasses. Not that I’m averse to old Game Boy / Color / Advance games, but if I’m going to play them, I’d rather emulate them on a large display.
The Future
In some of my weaker moments, I consider ordering up certain Banana Pi products (like the Banana Pi BPI-R2) with a case and doing my own router tricks using some open source router/firewall solution. And then I remind myself that my existing prosumer-type home router is doing just fine. But maybe one day…The post My SBC Collection first appeared on Breaking Eggs And Making Omelettes.