Why AWS MEDIACONVERT set EXTINF in m3u8 file equals to source video duration +1 sec? - http-live-streaming

I have a source mp4 file with duration=17sec (for example).
When i convert video to Apple HLS using AWS MediaConvert, i get the m3u8 file with duration 18sec .
I mean #EXTINF:18 tag in m3u8.
I use ABR mode.
SegmentControl settings are default
{
"OutputGroups": [
{
"Name": "Apple HLS",
"OutputGroupSettings": {
"Type": "HLS_GROUP_SETTINGS",
"HlsGroupSettings": {
"SegmentLength": 10,
"MinSegmentLength": 0,
"TargetDurationCompatibilityMode": "LEGACY",
"SegmentLengthControl": "GOP_MULTIPLE",
"SegmentControl": "SEGMENTED_FILES"
}
}
]
}
How to fix it? I tried to change different HlsGroupSettings but result remains the same

Thanks for your post. MediaConvert has a default setting to use whole integers for manifest durations. This means that if the source asset has even 1 extra frame of video or audio, the service will add a whole second to the segment duration. This may be why your output is appearing to be +1s longer than expected. You can change this segment duration setting to 'floating point' duration under "HLS Output Group / Avanced/ Manifest duration format". Try this and you might find the last segment is only slightly longer than expected.
You can ensure the source asset is exactly XX seconds long using the "input Clips" feature to specify a specific start + end timecode (HH:MM::SS:FF).
For the widest compatibility with streaming players we recommend using 1 second as the minimum segment duration. Very short segments (<1s) sometimes get skipped by some players or flagged by stream quality checking products. If a few extra frames of source content are found to exist, they will get added to the previous segment.
When measuring durations, be sure to check the actual media track durations and not just the file header metadata. Utilities such as ffprobe or mediainfo (use the --full flag) are helpful for this. The pts_time for each frame will indicate when it is supposed to start. The pkt_duration_time will indicate the duration of each frame.

Related

Debug manifest .mpd

After activating CORS on my webserver I have run my manifest on dash conformance webtool finding several errors that I can not interpret, at the moment I am not able to get the ABR behavior,Can i ask for help to understand how to fix the bug?
https://allibrante.com/live/manifest.mpd
Below some log reported from the Dash confromance webtool, for more details is better run the manifest on their webtool
Thanks a lot!
error: moov-1:trak-1:mdia-1:minf-1:stbl-1:stsd-1
SampleDescription sdType must be 'mp4v', 'avc1', 'encv', 'hev1','hvc1', or 'vp09'('mp4v', 'avc1', 'encv', 'hev1','hvc1','vp09')
Warning: Unknown atom found "avcC": video sample descriptions would
not normally contain this Warning: Unknown atom found "pasp": video
sample descriptions would not normally contain this Brand 'lmsg' not
found as a compatible brand for the last segment (number 3); violates
Section 3.2.3. of Interoperability Point DASH264: If the MPD#type is
equal to "dynamic" or if it includes MPD#profile attribute in-cludes
"urn:mpeg:dash:profile:isoff-live:2011", then: if the Media Segment is
the last Media Segment in the Representation, this Me-dia Segment
shall carry the 'lmsg' compatibility brand tfdt base media decode time
1658.000000 not equal to accumulated decode time 0.000000 for track 1 for the first fragment of the movie. This software does not handle
incomplete presentations. Applying correction.
error:
Buffer underrun conformance error: first (and only one reported here) for sample 1 of run 1 of track fragment 1 of fragment 1 of track
id 1 (sample absolute file offset 1356, fragment absolute file offset
860, bandwidth: 7591)
-
'tkhd' alternateGroup must be 0 not 1 Validate_ES_Descriptor: ES_ID
should be 0 not 2 in media tracks
WARNING: unknown sample table atom 'sgpd' WARNING: unknown mvex atom
'trep' WARNING: unknown/unexpected atom 'meta' Brand 'lmsg' not found
as a compatible brand for the last segment (number 3); violates
Section 3.2.3. of Interoperability Point DASH264: If the MPD#type is
equal to "dynamic" or if it includes MPD#profile attribute in-cludes
"urn:mpeg:dash:profile:isoff-live:2011", then: if the Media Segment is
the last Media Segment in the Representation, this Me-dia Segment
shall carry the 'lmsg' compatibility brand tfdt base media decode time
1657.984000 not equal to accumulated decode time 0.000000 for track 2 for the first fragment of the movie. This software does not handle
incomplete presentations. Applying correction.
error:
grouping_type roll in sbgp is not found for any sgpd in moof number 1
error:
grouping_type roll in sbgp is not found for any sgpd in moof number 1
error:
grouping_type roll in sbgp is not found for any sgpd in moof number 1
The cause of the majority of your problems is spelled out in the error message: This software does not handle incomplete presentations. You are trying to validate a live stream, and this tool does not currently have that capability.
With respect to the sample description issue, it looks like the validator does not recognise avc3 content (ie where the parameter sets are inband rather than in the initialisation segment). I would consider this a bug and suggest you raise an issue at https://github.com/Dash-Industry-Forum/Conformance-and-reference-source/issues.

How to retrieve the offset to the embedded JPG in a nef-file (Nikon raw format) in Lazarus

Goodmorning,
with my Nikon DSLR, I always shoot raw. I'd like to import my nef's in an import-folder and copy them from there with a name, prefixed by the date taken. In Lazarus I've created a class named TMyNef and I've managed to retrieve the date taken, ISO, Shutterspeed, F-Stops, exposure program, maker, model and focal length. I'm struggling with the offset to the embedded JPG. I need this because the Lazarus TImage-component doesn't support the NEF-format, but it can display JPG's perfectly. Every NEF has an embedded JPG (you see on the back of the camera), hidden in the PreviewTAG of the NEF. Basically, a NEF is almost the same as a TIFF. A Tiff uses IFD-s to store meta-information. So, I studied lots of sites about tiff, exif, Exiftool (Phil Harvey), DCRaw (Dave Coffin) I've used Exiftool.exe to analyse my nef's. I've even called "Exiftool.exe -b" within my program, but it's to slow.
Shortly, it comes down to:
Open the file
Read the header
Search for tag 0x8769 (the EXIF-tag)
If not found -> exit
Goto the offset where the EXIF-IFD starts
Search for tag 0x927C (The makernotes)
If not found -> exit
Goto to the offset where the MAKERNOTES-IFD starts
Read the Makernotes header
Search for tag 0x011, the Nikon Preview IFD
If not found -> Exit
Goto to the Nikon Preview IFD
Search for tags 0x201 (Start of the embedded JPG) and
tag 0x202 (Size of the embedded JPG)
If not found -> exit
Goto the start of the embedded jpg.
Read JPGSIZE-bytes from the file and copy them to a TMemorystream,
called Fms
Perform a Image1.Picture.LoadFromStream(Fms)
Summarized:
Open nef, search tag x08769, search 0x927C, search 0x0011, search 0x0201.
"Goto" means in the case: move the filepointer to the given offset.
Unfortunately, I've haven't been able the retrieve the offset of the embedded JPG. My program gives entirely different values than Phil Harvey's "Exiftool".
Jumping to "Phil's offset" and read until 0xFFD9 or read the amount of bytes given in tag 0x202, display's a perfect picture, going to the offset my program found and read until 0xFFD9, Lazarus says: Unsupported picture-format.
In the several IFD's I've found the meta-data I needed, so I took that along with me.
Does anyone know a way to retrieve the correct offset to the embedded JPG in a NEF? Or is there another way to display a NEF via the TImage-component in Lazarus?
Thanks in advance and best regards,
Martin
(Intel I5, 8Gb, Windows 10, Nikon Codec loaded, Lazarus 1.8)
Offsets within Exif structures usually are relative to the beginning of the TIFF header in front of the first Exif tag. This is true for jpeg and tiff files, not sure about NEF.

Replacing WAV header

So here is what I've got:
The problem that I face requires me to take a specialized header from WAV1 , and put it as the header for WAV2, in order to make WAV2 work with the API that I'm using. However, whenever I try to replace the first 38 characters of WAV2 with the first 38 of WAV1, I get an error when I try to play the file, I get an error saying that it is not formatted properly. Both WAV1 and WAV2 play properly before the edit.
Do you guys have any idea on what I'm doing wrong?
Thanks so much for your help.
-Rhynorater.
Wav format is a standardised format (see https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ for details about file format). I'm not sure what a "specialized" header is (perhaps you could clarify what your specialised header is?) as the format is standard - any variation would not be a wav file.
The first 38 bytes of a wav file are the header and should adhere to the standard. You cannot copy the header from one file and use it for another as the header contains information specific to the individual file (number of channels, sample rate, file length, etc).
If you both files playback normally (how are you testing this?) I'm not sure why the API you are using is not compatible (which API are you using?).

libsox split multichannel wav to mono channels

I want to split a Multichannel (2,8 or 16) wav file into its channels and save every channel in another wav-File.
So far I've accomplished to get libsox up and running in my c++, objective c++ project.
Libsox isnt well documented and there aren many examples on how to do it :(
I started by first openning the Inputfile
sox_format_t * in, * out;
assert(sox_init() == SOX_SUCCESS);
assert(in = sox_open_read((const char*)filename.c_str(),NULL,NULL,NULL));
Now I must find a way to get the number of channels of this file. Then I have to create the same amount of out-files and save every channel itself inside them.
How to do?
Thanks!
I think I will do it the old fashioned way.
Determine the channel count of the file.
Determine the length of the Data block.
Length of Data block / channelCount = Size of each channelBlock
Channels are saved like that inside a WavFile-Datablock (for 4Channel WavFile)
CH1/Ch2/Ch3/Ch4 CH1/Ch2/Ch3/Ch4.
I run through the datablock extract the channels and put them into a mono-wav-file

#EXTINF - field in apple hls playlist has decimal placed duration - generated by mediafilesegmenter

I am using mediafilesegmenter to generate HLS playlists for mp4 movies. My command is as follows,
mediafilesegmenter movieName.mp4 -I -f /Library/WebServer/Documents/vod/movieName/ -t 10 -l movie.log -k /Library/WebServer/Documents/vod/movieName/keys/ -K http://KEYSERVER/keys/ -key-rotation-period 10 -encrypt-rotate-iv-mbytes=1024 -J random
Through this command i am getting playlist generated fine, but the duration in #EXTINF: is decimal placed. I did checked the HLS draft, it says
The EXTINF tag specifies the duration of a media segment. It applies
only to the media URI that follows it. Each media segment URI MUST
be preceded by an EXTINF tag. Its format is:
#EXTINF:<duration>,<title>
>
"duration" is an integer or floating-point number in decimal
positional notation that specifies the duration of the media segment
in seconds. Durations that are reported as integers SHOULD be
rounded to the nearest integer. Durations MUST be integers if the
protocol version of the Playlist file is less than 3.
My question is How can i make #EXTINF to whole integer? I did used the option -t 10 and -t 15 and several numbers, but still my playlist has
#EXTINF:14.792, etc.
Can anybody point me what changes in the command to be made so that i get whole integer based #EXTINF ?
My mediasegmenter version is mediafilesegmenter: Beta Version 1.1(111116)
I am using Darwin Kernel Version 10.8.0 with x86_64 mac.
There is now a proper solution provided by Apple. You should use this flag to the mediafilesegmenter tool.
-no-floating-point-duration

Resources