Play MultipleAudioTrack in Roku - audio

I know about Roku doesn't support multiple videos at a time. But, Some Developers are mix up two things multiple playbacks and multiple audio tracks. Roku Does Support Multiple Audio Track?
I tried to Play MultipleAudioTrack in Roku. I used the below code to find a multiple audio track Here ?"m.video.availableAudioTracks :"m.video.availableAudioTracks but here not available any track. my stream check-in VLC MediaPlayer. Here two-track available. But, I not found in Roku. My Audio Format is AAC. I also Set Here m.video.audioFormat = "aac". Any other Configuration required to Playing a multiple Audio.
My m3u8 file is below.
#EXTM3U
#EXT-X-TARGETDURATION:9
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-VERSION:3
#EXTINF:8,
RokuMedia00000001.ts
#EXTINF:8,
RokuMedia00000002.ts
#EXTINF:8,
RokuMedia00000003.ts
Is there any configuration required for the m3u8 file.
I read the HLS Documentation which is provided by Roku. But, I have still some doubts regarding HLS Stream. I used the Roku Premiere plus device. 
For CC, I enable Closed Captions options using coding it's below.
m.videoContent.streamformat = "hls"
m.videoContent.subtitleTracks = [{ language: "EN", description: "EN", trackName: "eia608/1" }]
m.videoContent.subtitleConfig = { trackName: "eia608/1" }
It's not available in M3u8 file content. It's available on my ts File. I mention my M3u8 Content in the above.
Same way, I tried to enable Multiple Audio Track using Coding.
I used Following Field For fetching a multiple Audio Track.
?"m.video.availableAudioTracks :"m.video.availableAudioTracks
m.video.audioFormat = "aac"
I refer to this example of playing a Multiple Audio Track.
I used the aac audio format for playing audio in the Roku video player.
I check the same M3u8 File in other Video Player(VLC, IOS inbuilt player, EXO Player) It takes automatically shows two audio track. 
I'm not sure. But, I think Roku Video player Compalsary required multiple Audio tracks in M3u8 File. Like below. Is it Correct?
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English",LANGUAGE="en",AUTOSELECT=YES,\
DEFAULT=YES,URI="RokuMedia00000001.ts"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Spanish",LANGUAGE="es-ES",AUTOSELECT=NO,\
DEFAULT=NO,URI="RokuMedia00000001.ts"
But, Here It possible to Put the EXT-X-MEDIA tag in Two Times?
or I don't know which specific field will add I required.
I found one article in the Roku  Knowledge Center article Does Roku support multiple audio tracks?
But, I'm not required to enable multiple audio tracks at the same time. or also not required to playing simultaneously. I required to at a time only a single audio track. Because, I know any media player not support multiple audio track and video track the same time.
I required to change the audio track at run time. If my default track in English and using this option, I  change to It Spanish or any else.
My Actual question is a how-to enable audio track option which provide by Roku and which fields are required in m3u8 files. To enable these options. or Roku has stopped supporting audiotrack options?

I'm not certain about Audio files, but I know that Rokus don't allow you to buffer more than one Video at a time. This effectively means that a Roku cannot play more than one Video at a time.
The same could be true for audio files but I am not certain.

Roku does not support 2 or more parallel audios.
You have to stop one audio to play some another audio.
you can do it like
m.firstAudio.contorl = "stop"
m.secondAudio.contorl = "play"
note that you have to stop it not mute.

Related

How to include same segment into m3u8 playlist multiple times?

I have several .ts files, generated by ffmpeg from live stream. All of them have the same length (well, approximately). Ideally, they are being generated constantly, with names representing the datetime when they have been recorded (for example, "2019-04-11_10-51-40.ts"). But it may happen so, that for any technical reasons recording was being stopped for a while and files have not been generated.
Now, I have a task to create a playlist of these files for a certain datetime range - and if there are no files for part of this range, I need to show just a black screen. I have a black video for this purpose with the same length as other files. So, I'm trying to manually create an .m3u8 file and insert this black video in all gaps between normal videos that I have. For example:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:34
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:30.07,
http://example.com/black_video.ts
#EXTINF:30.07,
http://example.com/black_video.ts
#EXTINF:33.33,
http://example.com/2019-04-11_10-51-40.ts
#EXTINF:33.33,
http://example.com/2019-04-11_10-52-15.ts
#EXTINF:25.00,
http://example.com/2019-04-11_10-52-48.ts
#EXT-X-ENDLIST
The problem is that when I'm trying to play this playlist, it does not play correctly: depending on player either only one black part is being played no matter how much of them there are in a sequence (VLC), or player is getting stuck after first black video ("Play HLS M3u8" extension for Chrome or player on our own service, based on hls.js).
I also tried to use #EXT-X-DISCONTINUITY; in this case all videos are being played, but progress bar drops to the very beginning after each #EXT-X-DISCONTINUITY appearance, which is also an undesired behaviour. Example:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:34
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:30.07,
http://example.com/black_video.ts
#EXT-X-DISCONTINUITY
#EXTINF:30.07,
http://example.com/black_video.ts
#EXTINF:33.33,
http://example.com/2019-04-11_10-51-40.ts
#EXTINF:33.33,
http://example.com/2019-04-11_10-52-15.ts
#EXTINF:25.00,
http://example.com/2019-04-11_10-52-48.ts
#EXT-X-ENDLIST
As for black videos themselves, I tried several options: each link was to the same file; each link was to a different symlink to the same file; each link was to a separately generated black video - none of them worked.
As of now the only way I found is to collect all normal videos for the time range, fill the gaps with black video files and then combine them into one file with ffmpeg -f concat and split the concatenated file back to parts. But this approach works way longer than manual m3u8 file creation, so I would like to avoid it.
So, what could be the reason of manually formed playlist not working correctly and how could I fix that? May it be the problem with playlist itself, or playlist is technically fine but players I used possibly don't fully implement the specification?
TLDR: I am creating m3u8 playlist manually and I want to insert the same video multiple times into this playlist. Unfortunately, such playlist is not being played correctly: depending on player either this inserted video is being played only once no matter how many times has it been included, or playing is getting stuck after the first inserted video part. May it be that there is something wrong with playlist and how can this be fixed?
Add a #EXT-X-DISCONTINUITY tag before and after black_video.ts file and change the #EXT-X-VERSION tag to 5. That should fix the issue. This solution worked for me on VLC player.

For an HLS VOD Stream, Is it possible to only play specific Media Sequences in a Media Playlist File?

I'd like to play specific time-segments from an HLS Stream, without needing to re-edit the original MP4 file. Is it possible to alter the Media Playlist File to play specific TS Media Sequences that are out of order?
For instance, in the below M3U list, is it possible to only play fileSequence0-fileSequence2, then skip over fileSequence3 and go right to fileSequence4?
Example M3U List:
#EXTM3U
#EXT-X-PLAYLIST-TYPE:EVENT
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.0,
fileSequence0.ts
#EXTINF:10.0,
fileSequence1.ts
#EXTINF:10.0,
fileSequence2.ts
#EXTINF:10.0,
fileSequence3.ts
#EXTINF:10.0,
fileSequence4.ts
According to HLS Documentation, I would need to change or omit the Media Sequence Number for fileSequence3.ts in order to skip it, but I'm unsure if this is possible.
6.3.5. Determining the Next Segment to Load
...
The first segment to load is generally the segment that the client has chosen to play first (see Section 6.3.3).
In order to play the presentation normally, the next Media Segment to load is the one with the lowest Media Sequence Number that is greater than the Media Sequence Number of the last Media Segment loaded.
Yes, you can play them in any order, Just put a #EXT-X-DISCONTINUITY tag before any 'splice'. You also need #EXT-X-ENDLIST at the end, or the player will assume this is a live manifest and only play the most recent segments.
If the segments do not begin with keyframes however, you may not get the result you want.

WASAPI rendering the saved audio file

I am trying to play back the audio which was captured using waspi capture. The audio is saved in the form of wasapicapture.in file. Now the challenge is to play back the audio captured using wasapi renderer. I am able to play back, but the audio which I listen is always in stereo like, so its faster. I would like to reproduce that in original format. Could any help me please.
Thanks,
Read the file as Rawstream , pass in the WaveFormat the audio so that you can get the original recordered clarity aswell.
You could either save it into a .WAV file in the first place with WaveFileWriter, which will simplify playing it back. Or you can just read the file and pass it into a RawSourceWaveStream also passing in the WaveFormat the audio was originally recorded in.

how to play mpd file

.
I am trying to understand how mpd file plays and i am referring to the following data set:
http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/Valkaama/MPDs/Valkaama_1s_act_isoffmain_DIS_23009_1_v_2_1c2_2011_08_30.mpd
In mpd file format there is segment base consists of mp4 chunk and within it has chunk list with extension .m4s.I downloaded mpd file using :
http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/Valkaama/valkaama_1s/valkaama_1s_50kbit/valkaama_50kbit_dash.mp4
and m4s chunk by following link:
http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/Valkaama/valkaama_1s/valkaama_1s_50kbit/valkaama_1s1.m4s
I tried to play both mp4 and m4s in vlc player but not able to play any of these two so i want to ask which of the chunk links in the mpd file forma i can be able to play standalone in vlc player.
Please correct me if any of my observations is wrong:
Regards
Mayank
MPD file is just a index of streams with various formats in order to adapt to your bandwidth, to get more information follow the links of the other answers here.
It's possible to download all streams and merge them into a single file, you could achieve this by using youtube-dl:
youtube-dl http://URL/TO/manifest.mpd
You can get more information in https://stackoverflow.com/a/39931712/1522342.
Also, VLC 3.0.0+ can play that kind of file from a url, just open VLC, use the shortcut CTRL+N, paste the url and enjoy.
A DASH player plays an MPD by selecting a Period, and in the Period one or more AdaptationSet, and then one Representation per AdaptationSet. For the chosen Representation, it downloads and passes the intialization segment and some media segments to the media engine. As indicated by others you can simulate that by concatenating (simply using caton Linux).
The MPEG-DASH standard requires that initialization segments (in your case the mp4 file) contain no data. This is because when switching the player might use several times the initialization segment. You can open it in a player but it does not contain any media.
For m4s files, they contain media data but they cannot be interpreted without the associated initialization segment.
you can download init segment (SegmentBase/Initialization#sourceURL) and all media segments (SegmentList/SegmentURL#media) and concatenate everything (e.g. with the copy command on windows). The result should be playable on VLC. This has to be done for audio and video separately. In the next step you can then use MP4Box or similar tools to mux audio and video.
Alternatively you can use www.dash-downloader.com to download everything in one step. The page will display some log explaining what it's doing. That might be helpfull.
(full disclosure: that's my website).
I dont think it is possible to play any of the files in a standalone player. The mp4 is the init segment which is required to decode the .m4s media segments. I dont think there is an option in the vlc player to map an init segment to multiple media segments. Nevertheless you can try a Dash player to play the manifest file. For instance dash.js
Initialization segment: A sequence of bytes that contain all of the initialization information required to decode a sequence of media segments. This includes codec initialization data, Track ID mappings for multiplexed segments, and timestamp offsets (e.g. edit lists).
Media segment: A sequence of bytes that contain packetized & timestamped media data for a portion of the media timeline. Media segments are always associated with the most recently appended initialization segment.
Source: http://www.w3.org/TR/media-source/#init-segment

Can .m3u8 playlist files reference OTHER .m3u8 playlist files?

I know that the EXT-X-STREAM-INF tag provides a mechanism for linking to another playlist file, but this appears to be to support variant encoding's (at lower or higher bandwidth) of the same stream. What I would like to do is return a playlist that references actual .ts files but the last reference in the playlist is to the "next" .m3u8.
The reason I want this is that I can use this mechanism to build a stateless HLS server that is not necessarily serving a "live" stream (because the playlist URL can encode information about WHERE in the stream you are). Any idea what players support this (does iOS?)?
It is not supported in the draft specification (as of draft 10).
Yes They can. The main m3u8 that holds other m3u8 is called variant playlist m3u8.
But why we need a variant playlist? - for storing various bit rates of the same stream
I used "One Click m3u8" app from the mac app store - that created the variant playlist as well the children m3u8. No need of ffmpeg or mediafilesegmenter.
How to video here from youtube
Website

Resources