Before diving into the SDK Version, i simply tried to stream an x264 encdoed video to VLC. Streaming MP3 Works, but x264 takes a while then i get an error, that vlc cannot open the file.
1) Downloaded Live555 Server
2) Started EXE which states the url to use as: rtsp://172.18.1.85/<filename>
3) In VLC i am using: rtsp://172.18.1.85/fantastic.264 As the server output says "Each files type is inferred from it's name suffix" so i renamed the file from fantastic.mp4 to fantastic.264
As i've stated an mp3 stream works fine in the same directory where fantastic.264 is placed.
The file ending was correct but it wasn't an "elementary h264 stream". So I had to reconvert it to an elementary h264 file.
Quick Fix:
ffmpeg -i fantastic.mp4 -vcodec libx264 -f h264 fantastic.264
You can get here more Information:
What does Elementary Stream mean in Terms of H264
Related
I'm using an offline terminal to create an .m3u8 file but I would like to play it using VLC. Every example so far has shown examples of using m3u8 online but this isn't an option for me. If you can play it offline using VLC how do you do so?
You have to download the playlist from m3u8 to watch it offline and to do that you have to either use youtube-dl or ffmpeg
i would recommend ffmpeg , and the command for downloading the m3u8 file goes like this :-
ffmpeg -i "here your m3u8 link" -c copy Output.mp4
This will download the highest quality video available in that m3u8 file.
To change quality you can use map command or simply download the m3u8 file and open it with notepad and there you will find links for other resolution.
m3u8 files are just playlists without actual contents, but just URL pointers. Those files are mostly being used these days for HLS.
While you can play the files while offline, you won't see anything unless you are also hosting the referenced Contents.
How to convert .ogg file to any supported AVPlayer file format so that I can play it in app. Now if I am uploading .ogg file the player shows its raw data so how to solve this?
You can use mobile-ffmpeg!
Import mobile-FFmpeg to your project. If you do not know how to import, you can read this
Use this MobileFFmpeg.execute("-hide_banner -y -i [filename].ogg -c:a libmp3lame -qscale:a 2 [filename].mp3") (I found this from the sample code of mobile-FFmpeg)
And you will get the converted mp3 file in your project.
*note: if your .ogg file is from the server, please download it first.
I am using FFMPEG with Python to encode a low bit rate version of videos that I import. I would like the output to be playable on several devices, including Roku and iOS. This link states that Apple supports H264 High profile, level 4.1 and MP3 audio.
ffmpeg -preset veryslow -y -profile:v high -level 4.0 -movflags +faststart -codec:a libmp3lame -qscale:a 2 -s 1280x720 out.mp4
The resulting videos play fine in an HTML5 browser on a computer. However, on the iPhone the video appears but the audio stream does not play. Is there an issue with the mp3 settings?
From ffprobe:
[STREAM]
index=1
codec_name=mp3
codec_long_name=MP3 (MPEG audio layer 3)
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=s16p
sample_rate=44100
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=-1105
start_time=-0.025057
duration_ts=2321489
duration=52.641474
bit_rate=94949
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=2016
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=SoundHandler
[/STREAM]
I tried using AAC, but did not get good results with the native FFMPEG encoder
The document you reference is for HTTP Live Streaming, which uses a transport stream format, not an ISO mp4 format. Either way I have found many issues with mp3+video in ios. My recommendation is to use AAC (-acodec fdk-aac) instead of mp3. It is just as universally supported, and will provide you with better audio at lower bitrates. If that is not an option, try to specify all audio settings on the command line (-channles -samplerate, etc)
I've been asked by my client whether it is possible to download a video and stream it once a bit has downloaded, just like pocketcasts does. His reasoning is this will allow him to store his video files on a site such as godaddy and bypass the need to stream the file to the phone which normally requires a dedicated server.
Is this even possible? if so do you know anywhere I can look to find out how pocketcasts does it? At the moment my app just streams an mp4.
Thanks for looking,
Matt
Since you're targetting iOS, HLS (HTTP Live Streaming) is your friend: https://developer.apple.com/streaming/
Please see my answer here for how you can use it: Simultaneously downloading and playing a song that is pieced together from multiple URLs
It's very easy to run a long movie through the mediafilesegmenter tool from Apple (or FFMPEG) which spits out a number of small .ts files (MPEG 2 Transport Stream). Then you create a manifest (a .m3u8 file) which describes how these files fit together (which mediafilesegment will create for you too!). Then you just put the manifest file and the .ts files on a hosting provider (like GoDaddy) and you're all set.
For example, given a file called test.mp4, first turn it into a .ts file with ffmpeg:
ffmpeg -i test.mp4 -acodec copy -vcodec copy -bsf h264_mp4toannexb test.ts
Then turn it into a series of HLS segments with mediafilesegmenter (the same can be done using the ffmpeg segment muxer, but mediafilesegmenter seems to be more robust):
mediafilesegmenter -t 3 test.ts
The result is a bunch of 3 second clips (that's what -t 3 means) and an manifest file called prog_index.m3u8. The contents of that look like:
#EXTM3U
#EXT-X-TARGETDURATION:3
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:2.99520,
fileSequence0.ts
#EXTINF:2.99520,
fileSequence1.ts
#EXTINF:2.99520,
fileSequence2.ts
#EXTINF:2.99520,
fileSequence3.ts
...
#EXTINF:0.37440,
fileSequence75.ts
#EXT-X-ENDLIST
Simply putting all of the .ts files and the .m3u8 file on a web server and pointing your AVPlayer or MPMoviePlayerController in iOS at the URL for the .m3u8 will get you an excellent streaming performance.
While working on a rhythm music game, I noticed that AVAudioPlayer has a latency between the reported .currentTime and the actual location within an audio file, that varies according to the file format.
For instance, playing an .m4a file will produce lower latency than playing an .aac file (ADTS AAC).
That's somewhat understandable and I came to accept this already (as the latency was a constant according to file type).
What I don't understand, is why these different latencies might also happen for 2 kinds of .m4a files, those converted from an original AIFF file, and those first converted to ADTS AAC and then converted to .m4a
In other words:
If I run:
afconvert -f m4af -d aac my_aif_file.aif
I get a file playing in lower latency than a file that was created like this:
afconvert -f adts -d aac my_aif_file.aif
afconvert -f m4af -d aac my_aif_file.aac
Any explanation/solution to understand these different outcomes will be appreciated.
Found the issue - it's the conversion itself.
When converting to adts aac the converted audio has a prefix of about 40ms of silence...
Weird...