
Recherche avancée
Autres articles (48)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone.
Sur d’autres sites (4581)
-
libaomenc : fix profile setting
29 mars 2018, par James Almer -
pydub.exceptions.CouldntDecodeError : Decoding failed. ffmpeg returned error code : 1
9 avril, par azail765This script will work on a 30 second wav file but not a 10 minutes phone call also in wav format. Any help would be appreciated


I've downloaded ffmpeg.


# Import necessary libraries 
from pydub import AudioSegment 
import speech_recognition as sr 
import os
import pydub


chunk_count = 0
directory = os.fsencode(r'C:\Users\zach.blair\Downloads\speechRecognition\New folder')
# Text file to write the recognized audio 
fh = open("recognized.txt", "w+")
for file in os.listdir(directory):
 filename = os.fsdecode(file)
 if filename.endswith(".wav"):
 chunk_count += 1
 # Input audio file to be sliced 
 audio = AudioSegment.from_file(filename,format="wav") 
 
 ''' 
 Step #1 - Slicing the audio file into smaller chunks. 
 '''
 # Length of the audiofile in milliseconds 
 n = len(audio) 
 
 # Variable to count the number of sliced chunks 
 counter = 1
 
 
 
 # Interval length at which to slice the audio file. 
 interval = 20 * 1000
 
 # Length of audio to overlap. 
 overlap = 1 * 1000
 
 # Initialize start and end seconds to 0 
 start = 0
 end = 0
 
 # Flag to keep track of end of file. 
 # When audio reaches its end, flag is set to 1 and we break 
 flag = 0
 
 # Iterate from 0 to end of the file, 
 # with increment = interval 
 for i in range(0, 2 * n, interval): 
 
 # During first iteration, 
 # start is 0, end is the interval 
 if i == 0: 
 start = 0
 end = interval 
 
 # All other iterations, 
 # start is the previous end - overlap 
 # end becomes end + interval 
 else: 
 start = end - overlap 
 end = start + interval 
 
 # When end becomes greater than the file length, 
 # end is set to the file length 
 # flag is set to 1 to indicate break. 
 if end >= n: 
 end = n 
 flag = 1
 
 # Storing audio file from the defined start to end 
 chunk = audio[start:end] 
 
 # Filename / Path to store the sliced audio 
 filename = str(chunk_count)+'chunk'+str(counter)+'.wav'
 
 # Store the sliced audio file to the defined path 
 chunk.export(filename, format ="wav") 
 # Print information about the current chunk 
 print(str(chunk_count)+str(counter)+". Start = "
 +str(start)+" end = "+str(end)) 
 
 # Increment counter for the next chunk 
 counter = counter + 1
 
 
 AUDIO_FILE = filename 
 
 # Initialize the recognizer 
 r = sr.Recognizer() 
 
 # Traverse the audio file and listen to the audio 
 with sr.AudioFile(AUDIO_FILE) as source: 
 audio_listened = r.listen(source) 
 
 # Try to recognize the listened audio 
 # And catch expections. 
 try: 
 rec = r.recognize_google(audio_listened) 
 
 # If recognized, write into the file. 
 fh.write(rec+" ") 
 
 # If google could not understand the audio 
 except sr.UnknownValueError: 
 print("Empty Value") 
 
 # If the results cannot be requested from Google. 
 # Probably an internet connection error. 
 except sr.RequestError as e: 
 print("Could not request results.") 
 
 # Check for flag. 
 # If flag is 1, end of the whole audio reached. 
 # Close the file and break. 
fh.close() 



I get this error on
audio = AudioSegment.from_file(filename,format="wav")
:

Traceback (most recent call last):
 File "C:\Users\zach.blair\Downloads\speechRecognition\New folder\speechRecognition3.py", line 17, in <module>
 audio = AudioSegment.from_file(filename,format="wav")
 File "C:\Users\zach.blair\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pydub\audio_segment.py", line 704, in from_file
 p.returncode, p_err))
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1
</module>


Output from ffmpeg/avlib :


ffmpeg version N-95027-g8c90bb8ebb Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 9.2.1 (GCC) 20190918
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
 libavutil 56. 35.100 / 56. 35.100
 libavcodec 58. 58.101 / 58. 58.101
 libavformat 58. 33.100 / 58. 33.100
 libavdevice 58. 9.100 / 58. 9.100
 libavfilter 7. 58.102 / 7. 58.102
 libswscale 5. 6.100 / 5. 6.100
 libswresample 3. 6.100 / 3. 6.100
 libpostproc 55. 6.100 / 55. 6.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '2a.wav.wav':
 Duration: 00:09:52.95, bitrate: 64 kb/s
 Stream #0:0: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (pcm_mulaw (native) -> pcm_s8 (native))
Press [q] to stop, [?] for help
[wav @ 0000024307974400] pcm_s8 codec not supported in WAVE format
Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
Error initializing output stream 0:0 -- 
Conversion failed!



-
Video capturing in portrait mode but the orientation is wrong when played back with a media player
17 octobre 2016, par Ahmed MujtabaI’m trying to make a custom video app. The app captures a video using mediarecorder and uploads it to the website where it’s played on a html5 media player. The issue is that, when I capture the video in portrait mode, the playback video on the website and on vlc player have it’s orientation off by 90 degrees. I have tried various solution on the internet but none work for me.
Here’s what my code for setting up the media recorder :
private bool prepareMediaRecorder() {
Android.Hardware.Camera.Parameters p = mCamera.GetParameters();
List previewSizes = p.SupportedPreviewSizes.ToList();
//mCamera = GetCameraInstance();
//setCameraDisplayOrientation(Activity, cameraId, mCamera);
mediaRecorder = new MediaRecorder();
mCamera.Unlock();
mediaRecorder.SetCamera(mCamera);
mediaRecorder.SetAudioSource(AudioSource.Camcorder);
mediaRecorder.SetVideoSource(VideoSource.Camera);
mediaRecorder.SetOrientationHint(CameraS.result);
if (currentapiVersion >= 16)
{
mediaRecorder.SetProfile(CamcorderProfile.Get(CamcorderQuality.High)); // requires API Level 8 or higher
}
else
{
mediaRecorder.SetProfile(CamcorderProfile.Get(CamcorderQuality.Q480p)); // requires API Level 8 or higher
}
//mediaRecorder.SetVideoFrameRate(30);
mediaRecorder.SetOutputFile(localPath);
mediaRecorder.SetMaxDuration(600000); // Set max duration 60 sec.
mediaRecorder.SetMaxFileSize(50000000); // Set max file size 50M
mediaRecorder.SetVideoSize(previewSizes[0].Width, previewSizes[0].Height);
mediaRecorder.SetPreviewDisplay(mPreview.Holder.Surface);
mediaRecorder.SetOrientationHint(getDisplayOrientationAngle());
try
{
mediaRecorder.Prepare();
}
catch (IllegalStateException e)
{
releaseMediaRecorder();
return false;
}
catch (Java.IO.IOException e)
{
releaseMediaRecorder();
return false;
}
return true;
}
public int getDisplayOrientationAngle() {
//Log.e("", "setDisplayOrientationAngle is call");
int angle;
var mDisplayRotation = Activity.WindowManager.DefaultDisplay.Rotation;
// switch (MeasurementNativeActivity.DisplayRotation) {
switch (mDisplayRotation)
{
case SurfaceOrientation.Rotation0: // This is display orientation
angle = 90; // This is camera orientation
break;
case SurfaceOrientation.Rotation90:
angle = 0;
break;
case SurfaceOrientation.Rotation180:
angle = 270;
break;
case SurfaceOrientation.Rotation270:
angle = 180;
break;
default:
angle = 90;
break;
}
//Log.v("", "media recorder displayRotation: " + mDisplayRotation);
//Log.v("", "media recorder angle: " + angle);
return angle;
}The orientation of the video is fine when played on the phone app but on the website it’s not. I tried to use FFMPEG encoder to rotate the video clockwise. This seemed to fix the orientation of the video, however the aspect ratio of the video is all messed up. The video is stretched vertically and goes off screen.
The command I’m using to rotate and encode the video is as follows :-y -i inputPath -vf scale=640:480,setsar=1,transpose=1 -strict experimental -r 25 -vcodec mpeg4 -b 1000k ab 48000 -ac 2 -ar 22050 destinationPath
I will really appreciate if someone can help me fix either the orientation of the video or the aspect ration after encoding the video.
Cheers !
Edit.
Here’s the readout of the input file :
General
Complete name : C:\Users\Ahmed\Desktop\9adcdb56-500e-4d3f-8fb2-ccf20c680422_yt.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 6.30 MiB
Duration : 12s 437ms
Overall bit rate : 4 251 Kbps
Encoded date : UTC 2016-05-29 23:54:30
Tagged date : UTC 2016-05-29 23:54:30
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3.1
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=31
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 12s 323ms
Bit rate : 3 967 Kbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Rotation : 90°
Frame rate mode : Variable
Frame rate : 29.700 fps
Minimum frame rate : 29.354 fps
Maximum frame rate : 30.040 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.145
Stream size : 5.83 MiB (92%)
Title : VideoHandle
Language : English
Encoded date : UTC 2016-05-29 23:54:30
Tagged date : UTC 2016-05-29 23:54:30
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 12s 437ms
Source duration : 12s 454ms
Bit rate mode : Constant
Bit rate : 128 Kbps
Nominal bit rate : 96.0 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 194 KiB (3%)
Source stream size : 194 KiB (3%)
Title : SoundHandle
Language : English
Encoded date : UTC 2016-05-29 23:54:30
Tagged date : UTC 2016-05-29 23:54:30
mdhd_Duration : 12454