Google Speech API doesn't give correct result when audio is sent in file - perl

I chanced upon the article at Google Speech API which suggested a mechanism for extracting text from audio file through Perl. Now I have recorded a audio file, which you will find at http://vocaroo.com/i/s0lPN5d3YQJj. It is a simple piece of audio, reading I love you. When I go to the Google speech API in Chrome, and speak those words, I get the right result. When I try the code at the above mentioned link with the audio file I pointed out, it returns strange results, like logan. How can I make it more accurate? This is just a sample audio, what I am generally doing is extracting the audio from a video file through FFMpeg using something like ffmpeg -i input.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output.mp3, followed by ffmpeg -i input.mp3 output.flac.

Have you tried playing the audio files you are creating?
You are setting an audio bitrate of 192 bits/second which is ridiculously low.
For 192Kbps you need -ab 196608.

Related

MOV_RESAVE_CORRUPTED error on submitting app preview

When uploading an app preview to the app store submit process, I receive an unknown error MOV_RESAVE_CORRUPTED which is not documented anywhere in their uploading process.
I have captured the preview using QuickTime and had to reformat it using ffmpeg to a 30 FPS video, using this command
ffmpeg -r 30 -i preview1.mov -acodec copy -crf 12 -vf scale=886:1920,setsar=1:1 preview1-edit.mp4
The video is working fine on my local machine but upload won't work.
Frankly, the whole process is very annoying and super stressful. Hopefully I can help anyone else having this problem with this thread.
Thank you.
SOLUTION: In my case the issue was the audio encoding, used Handbrake free video tool and ensured the video specs were set to:
Video Codec (FPS) to : H.264(x264) Video Framerate (FPS) to : 30 Audio Codec to : AAC (Core Audio) Audio Mixdown to : Stereo Audio Sample rate to : 44.1 Audio Bitrate to : 256
The app preview videos are working fine now!
Create a new Preset. Set name iPhone 6.5 App Preview to recognize easily.
Select Audio Behavior. Set samplerate to 44.1, bitrate to 256. Then save it
Go to Audio tab. Then select Presets from right up corner.
Check audio samplerate and bitrate then click Start. Then upload it.
App Store Connect is very tough about video formats, only accepts H264 + AAC in mp4 or mov container, otherwise it just says (after 10 minutes): MOV_RESAVE_CORRUPTED. See details: https://help.apple.com/app-store-connect/#/dev4e413fcb8

Encoding video for streaming with multiple subtitle streams in VLC

I am implementing an offline video streaming service, so our users can have the encrypted videos on their computers and open them only by using our streaming app.
So what I need is to stream a freshly decrypted video file directly to a local VLC client so I don't have to save it on disk. A minimum working example would be:
cat my_video.mp4 | vlc -
But this only shows the video and audio tracks, no subtitles.
I want to know if there is a way to encode a video so that this would work with 3 audio tracks and 3 subtitle tracks.
I would also settle for an answer explaining that it is not possible and why not.
More details below:
I have 3 audio tracks and 3 subtitle tracks and I am using FFMPEG.
(The original format of the videos is mp4 with an h264 encoding)
Currently, I am able to make streamable .mp4 files, thanks to this answer, and also to make .ts files that will show the video and the 3 audio options but not the subtitles. The command I am using is this:
video_name=demo_0101.mp4
sub_name=demo_0101.srt
output=0101.mp4 # Or `.ts`
ffmpeg\
-i en_raw/$video_name -i pt_raw/$video_name -i es_raw/$video_name\
-i en_subs/$sub_name\
-i pt_subs/$sub_name\
-i es_subs/$sub_name\
-map 2:v\
-map 0:a:0 -map 1:a:0 -map 2:a:0\
-map 3:s -map 4:s -map 5:s\
-c:v libx264 -crf 22\
-movflags faststart\ # (This line is only necessary for .mp4)
-c:a:0 aac -c:a:1 aac -c:a:2 aac\
-c:s:0 mov_text -c:s:1 mov_text -c:s:2 mov_text\
$output
The problem is: The subtitles are not recognized (don't show up at all) using the .ts format and when using .mp4 VLC reports an error:
Unidentified codec:
VLC could not identify the audio or video codec
Please note when not streaming the .mp4 version works with all audios and the subtitles, i.e.:
vlc my_video.mp4
In case someone is wondering I plan on selecting the which subtitle and audio to play from command line with the VLC options: --audio-track 1 --sub-track 0
I hope someone can help me. Thanks in advance.
I was unable to find a way to encode the subtitles directly on the video which would be the preferable solution. However, I found a VLC command that will display the subtitle file together with the streaming video:
cat 0101.mp4 | vlc --sub-file en_subs/demo_0101.srt
This is not ideal for 2 reasons:
It does not work with the .ts format only .mp4.
This requires me to save the original subtitle files on the user disk.
I will not mark this solution as the accepted answer because if it is possible to stream the video directly with the subtitles I want to know, and I also believe that such answer would be helpful for others that happen to read this page.

How to add MOV file header to raw data written file with ffmpeg?

I am going to record H264 encoded video stream data in iOS using swift.
I am not familiar with video codec formats so don't know how to do this. But I've tried to write the H264 raw video data to the file sequently and see its file Info. I am surprised that it has almost video file info (compared with standard mp4, MOV file). The only missing info is video duration, file size, overall bit rate, encoded data, etc. So I am just wondering if video can play if I add the MOV file header to this file manually. Spent few hours to googling how to add MOV file header with ffmpeg but stacked. Any help would be appreciated. Thanks
You can nominally use ffmpeg to do this:
ffmpeg -i in.h264 -c copy out.mov
However, due to a bug in ffmpeg relating to generation of PTS for video streams with multiple B-frames, the output video may not play smoothly. Test and check.
If it doesn't there's a workaround which involves using mp4box from GPAC.
mp4box -add in.h264 -new out.mp4
and then
ffmpeg -i out.mp4 -c copy out.mov

HTML5 Video tag issues on Iphone 4

Hello I am very new to HTML5 video and I'm having a problem with videos NOT playing on my iPhone 4 (running iOS 6.1.2) when using the HTML5 video tag.
The video runs fine on a computer with Google Chrome. The browser I am using Safari on the iPhone.
I have tried using multiple file formats together such as .OGG .webM and h264 MP4.
Something that is really confusing me however is that I have tried playing a HTML5 video at the bottom of this article on my iPhone and it still does not work.
I thought this blog would be the example to follow for HTML5 video, but now I really can't work out what is going wrong. I also tried it on another iPhone4 and it did not work.
Does anyone know what is going on here or what the problem is with HTML5 video on the iPhone? Could someone help me with a good way to display video that is not using something like Youtube but more along the lines of HTML5?
Thank you!!
This may help you
We need three formats of HTML5 to be able to work on all browsers including mobiles.
mp4 encoded with H.264
webm
ogv
Encoding video using ffmpeg:
ffmpeg -i input.mp4 -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -codec:a libfdk_aac -b:a 128k output.mp4
detail here http://skillrow.com/html5-video-for-all-browsers/

which sound format is best for cocos2d game project?

i am new in cocos2d and facing hard time to find the best file format which is supported in cocos2d ?
and can i use ogg file format if Yes then please any link how to use it is cocos2d
No ogg on iOS. Here's the AVAudioPlayer supported audio formats list.
You also have to differentiate between background audio (streaming audio) and audio effects. For the former you should use mp3 and play only one mp3 at a time because the iOS devices can only decode one mp3 at a time using hardware. Additional mp3 are decoded with the CPU.
For audio effects uncompressed .caf and .wav files are standard. You want them to be 16-bit, mono and using a sample rate of 11, 22 or 44 kHz depending on the quality you need. Personally I would default to 22 kHz.
Here is the way to convert audio to best iOS formate: Click HERE
Open terminal and run this command:
afconvert -f caff -d LEI16 sound.wav
Any file that are supported in iPhone but for me .wav files are better.