Writing QuickTime files manually - quicktime

In the app I'm working on, there's an AVIRecord class that manually write AVI headers and JPEG frames into a video files. They are .avi files with MJPEG codec, according to my media player (using KLite codec pack).
My question is: is this AVI compressed or uncompressed? Because the file size is basically sum of all the jpeg frames.
Can I write a similar code to produce a .mov file (Quicktime format)? By similar i mean: writing headers to the file, putting each frames manually into the files.
The app I am working on is supposed to save the jpeg stream from a IP Cam and save it under quicktime format.

Most file formats like AVI, MOV do not compress the video and audio bitstreams present in them. File formats are used to store video and audio decodeable units with associated metadata like timestamps. So when you add JPEGs to AVI file, it does not get compressed any further.
You can create MOV file with MJPEG video, similar to way you have been able to create AVI file with MJPEG video. However you would need creator for MOV (similar to the one you have for AVI).
MOV file format has been specified by Apple. A version of the format is available at http://developer.apple.com/standards/qtff-2001.pdf

Related

Speech Recongnition Using OpenVINO

I want to implement a python project in which the input will be a .mp4 file and the output will be the transcript or subtitle of the video. The constraint is to use OpenVINO. How can I do that?
mp4 is a container. I believe the current OpenVINO speech demo/samples use wav files as that is what the model is trained for.
If you can convert your mp3 or audio from the mp4 container using a tool to convert it to the wav format, that may work.
speech rec demo

.m4a is considered audio/m4a or audio/mp4

I'm trying to make an audio upload to S3 and I'm a little confused what I should declare my mime type as. My audio file is an m4a recorded on an iphone as kAudioFormatMPEG4AAC. Would this be considered audio/m4a or audio/mp4? I'm seeing conflicting answers online.
The m4 in m4a is short-hand for MPEG-4, just like mp4 is short-hand for MPEG-4.
In fact, m4a, m4v and mp4 files all have the same internal MPEG-4 atom structure. The difference between the files is their content (video files have video atoms as well as audio atoms.)
The codec of the audio can also be different despite using the same file extension, for example both alac and AAC formats use the MPEG-4 container format with the m4a file extension.
So to answer your question, it really doesn't make much difference. My personal preference would be audio/mp4 since that is effectively saying
Audio data in MPEG-4 container
Whereas, audio/m4a is like saying
Audio data in MPEG-4 container containing audio
Use audio/mp4. audio/m4a may work, but it's invalid.
MP4 MIME type registration:
2. Selection of MIME Types for MP4 Files
The MIME types to be assigned to MP4 files are selected according to
the contents. Basic guidelines for selecting MIME types are as
follows:
a) if the file contains neither visual nor audio presentations, but
only, for example, MPEG-J or MPEG-7, use application/mp4;
b) for all other files, including those that have MPEG-J, etc., in
addition to video or audio streams, video/mp4 should be used;
however:
c) for files with audio but no visual aspect, including those that
have MPEG-J, etc., in addition to audio streams, audio/mp4 may be
used.
In any case, these indicate files conforming to the "MP4"
specification, ISO/IEC 14496-1:2000, systems file format.
Further, the list of standard MIME types includes audio/mp4, not audio/m4a, and non-standard MIME types should include “x-”, like audio/x-m4a.
In 2021 for me audio/mp4 for an .m4a file worked on Firefox + Chrome (Linux), Opera (Android) but not on iPhone Safari. For some formats the OS plays a role due to codecs.
I used a source tag with type attribute set and I also set the same type in the Content-Type header of the streamed / downloaded file.
https://en.wikipedia.org/wiki/HTML5_audio#Supported_audio_coding_formats
https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Cross-browser_audio_basics
https://developer.mozilla.org/en-US/docs/Web/HTTP/Configuring_servers_for_Ogg_media
Also see: How to play .m4a with HTML5 audio in IE(9+) and Safari (Pad)?

How to convert .mp4 file to .webm using avconv tool

I have .mp4 file and I want to convert it to .webm with the same quality by avconv tool,
and vice from .webm to . mp4 with the same quality
document fuzzy to me.
That's not possible. WebM cannot contain MPEG media (video or audio.) So you can't repack ("remux") the media from mp4 to webm. You would need to re-encode them ("transcode" them), with VP8 or VP9 as the video format and Vorbis as the audio format. Thus you can't have the same quality, since transcoding from one lossy format to another always loses some quality.
So your only option is to transcode.

Can I extract or convert a video file to audio?

I have a case where i need to get audio out from video file. Is this possible in iOS ??
I need only the output file as an audio any type. I have the video file in my documents directory which I record earlier in application.
1.Convert Video Reverse
2.Extract audio from a video file
3.Add Audio & Video Together
Download Code From Here
may be helpful to you.
Yes, it can be done. See Extract audio from video file for ideas.
Extracting is probably the more accurate term.

Do I need to convert audio files to .wav first before converting to .caf?

I have several audio files which all of them are in .mp3 format. But playing .mp3 won't maximize the efficiency of audio playing on iOS. From one of research, .wav or .caf is a go for short loop or sound effect audio file used in game. Thus I need to convert this .mp3 file into those two formats.
Currently I use the following command to convert .mp3 to .caf.
afconvert -f caff -d LEI16 kick_sfx.mp3
However, I see that .caf is a container format thus I have a bad feeling that it's still not so efficient. According to that, I think I need to convert those .mp3 files to .wav first in order to maximize efficiency in playing audio file.
Do I need to really convert those (.mp3) files to .wav first before convert them again to .caf? Or using that command alone will do the work for me ?
Any additional info is welcome.

Resources