Working out the kinks, so looking at everything for a clue on what is wrong, and this seems very odd after i merge, on a windows box using copy /b.
At each merge point in the merged file, i have all of this header info, and it would seem that it would be on header block, and the rest all media data to play the file, so is the following normal, or is my merge messed up (i am a coder, but have no clue on media file workings, never really played in the area):
[Attachment 58825 - Click to enlarge]
this is at every point the next file comes in.
I thought i was close to the bottom of the hill on this project, but guess not LOL.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 9 of 9
Thread
-
-
"Copy /B" is a quick and VERY dirty way of merging, which I've warned against for years, due to the very real possibility of encountering issues such as you are now seeing. You've probably just lucked out until now.
The problem with copy/b is that it retains all the interim headers and timings, which wouldn't exist if it was properly merged (it would/should only have the main header and have new consecutive timings). This can confuse players/editors.
I suggest you use a different method, perhaps Avidemux or some other gop-level, non-re-encoding editor, or perhaps an ffmpeg merge (concat) script.
Scott -
Normal ? Yes. The /b treats each file as binary so grabs all the bytes whether they can be used or not.
What is more critical is if the player ignores the header and just treats the data after that as part of the original.
But AFAIK it will process that data as if it was prepared in accordance with the original header. So merging files from different encoding parameters is not going to work.
Or to put all that in another way, if there is visual and/or audio disturbance at the point where you appreciate the merge has taken place a merge is not an appropriate tool and a re-encode is more appropriate. -
If OP is working with fMP4 (fragmented dash), especially if the source files are encrypted, then raw binary concatenation is the only type of "merging" that will work, assuming, of course, that OP wants to decrypt the merged file afterwards. As mentioned previously here.
That method will never work for fMP4, assuming, again, that successful decryption is desired.
OP has posted several threads about this topic without any reference to the actual source url(s) and/or file(s) that are being used. Someone could probably walk him through the process if his post(s) started from the very beginning. -
That's an assumption. I didn't get that anywhere from the OP, other than possibly "=stitchable".
But that assumption is fragile, assuming 1. It's that format. 2. It's encrypted. 3. It's encrypted in that method, requiring that workflow.
Assuming it is...
For NON-encrypted material, my caveat and recommendations still hold true.
"Encrypted", hmm??!!
Scott -
Lost my reply twice submitting to post >(.
Anyhow, i do leave many things out, since i am not 100% sure where the lines are, and do not what the boot/ban, so been trying to stay on the safe side. Since i lost a nice reply, explaining the questions posted bu each person, i am juts going to try and answer all the questions in one long reply.
First, yes this is still the same project, that someone referred to, when the shared the post with "fragments vs segments", i came the conclusion they are the same, since i cannot find anywhere where they are handled or formatted differently, so the "f" or "s" was just dealer's choice, with the project team, and has no real value. I do have many posts about the project i am working on, the MPD is completely new, i cannot find any examples of what i am seeing, or even a white paper on it, all of the info is there, it is just wrapped differently so had to work though the parsing, the best i could, but seems like i have that working.
At first i thought the MPD was being updated on the fly, but it is just part of this new format. the MPD link is only valid for about 5min, if that, then, the file name changes, so you get one shot at getting the MPD downloaded, however, once you have the file, the links inside stay valid for about a week, then, you need to grab a new MPD to work with.
if what i am posting is against the rules, please give me a fair warning, and just delete this section if needed.
Code:<MPD mediaPresentationDuration="PT42M0.831999S" minBufferTime="PT4.096S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011"> <Period duration="PT12M15.103999S" id="c-0-000-180"> ********FOR AUDIO <AdaptationSet audioSamplingRate="48000" contentType="audio" group="1" lang="en" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1"> <ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="6289ed1d-0b51-474b-bbe1-ed14cf1b86ed"> <SegmentTemplate duration="368640" initialization="https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/TK_init.mp4?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" media="TK_$Number%08d$.m4f?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" startNumber="0" timescale="90000"></SegmentTemplate> ***** END ADUIO ***** INIT SECTION <AdaptationSet contentType="video" id="1" maxFrameRate="30" maxHeight="540" maxWidth="960" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1"> <ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="5f4e1b45-807b-4cd3-af0f-f9bcf3e47628"></ContentProtection> <SegmentTemplate duration="368640" initialization="https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/$RepresentationID$_init.mp4?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" media="$RepresentationID$$Number%08d$.m4f?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" startNumber="0" timescale="90000"></SegmentTemplate> ****** END OF INIT ****** FRAGMENT SECTION <AdaptationSet contentType="video" id="2" maxFrameRate="30" maxHeight="1080" maxWidth="1920" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1"> <ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="3a48357b-1e69-4004-a859-475e6052b71c"></ContentProtection> <Representation bandwidth="3170041" codecs="avc1.64001f" frameRate="30" height="720" id="E" scanType="progressive" width="1280"> <BaseURL>https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/</BaseURL> <SegmentTemplate duration="368640" initialization="https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/$RepresentationID$_init.mp4?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" media="$RepresentationID$$Number%08d$.m4f?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" startNumber="0" timescale="90000"></SegmentTemplate> </Representation> **** END OF FRAGMENT
My code flow is:
Parse the MPD for the fragment count (get the last period node, split the ID to get the count), file URL, nothing more than that, so maybe i need more info?
Replace the file varibales as needed, ($ReprentationID$ is the resolution A - lowest, F - highest, $Number$ is the fragment number, and padded to 8 in len, so it becomes like A00000000.mf4)
Download part 1 - i download the init.mp4 files for both audio and video, and keep the video init to the side, since it has its own key.
Download part 2 - loop through the fragments, merging the video fragments in one file, and keep it to side since this has a different key, Audio gets merged right into the audio init file, since that has one key. I have been using the "copy /b" for this, so could be the issue, but works for the audio, and seems like what i am getting on the inside of the merged file, from my 1st post here, this is normal, so i am going to assume there is some kind of flag, to let the player know where the media playback starts, and end to skip each playback info header.
Decrypting with mp4decrypt, and this is where it all fails for the video.
send the raw audio file, with the KID and Key, decrypts fine, i can play the audio file, so it is in the clear
send the raw video init file with its KID and Key, this may me in the clear, it is hard to tell, unless i look at it better, since the raw is 1K, and output is 1K
send the raw merged fragment source with its KID and Key, this is where is blows up, i send in a 57MB file, and get a 1K on the output, however, if i merge the init file, with the merged fragments, i get the proper output file size.
I am more than happy to share more in a PM, since i know this reply is close to the line as it is.
Thanks,
Dave -
one thought i had on this, and have not tried yet, since it came to me on the way to work, is do i need to merge the init file to each fragment? if i am reading the XML correctly for the file
Code:<Representation bandwidth="3170041" codecs="avc1.64001f" frameRate="30" height="720" id="E" scanType="progressive" width="1280"> <BaseURL>https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/</BaseURL> <SegmentTemplate duration="368640" initialization="https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/$RepresentationID$_init.mp4?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" media="$RepresentationID$$Number%08d$.m4f?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" startNumber="0" timescale="90000"></SegmentTemplate> </Representation>
I just do not know enough about how media files work, have not done anything like this until now. -
yes, you can try it
for mpd i used to concat init and segments like this:
(init + seg1) + (init + seg2) + (init + seg3) + ...
just recently i found someone here said to concat init and segments like this:
init + seg1 + seg2 + seg3 + ...
so for the last mpd I downloaded, I tried both ways
and somehow they both work and after processed by ffmpeg (either mux with audio or copy to a different container), they become the same file (same CRC-32)
maybe ffmpeg can remove redundant headers
but i think you didn't download the files correctly
init and segments defined in the same SegmentTemplate tag:
"initialization" and "media" and they have the same kid in your case -
Code:
<AdaptationSet contentType="video" id="2" maxFrameRate="30" maxHeight="1080" maxWidth="1920" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1"> <ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="3a48357b-1e69-4004-a859-475e6052b71c"></ContentProtection> <Representation bandwidth="3170041" codecs="avc1.64001f" frameRate="30" height="720" id="E" scanType="progressive" width="1280"> <BaseURL>https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/</BaseURL> <SegmentTemplate duration="368640" initialization="https://x-default-stgec.uplynk.com/ausw/slices/50e/e6cf0c55dac249f0a0f72e7c72e6f6cb/50e77f51a8f241baa0c0afa9a4185df4/$RepresentationID$_init.mp4?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" media="$RepresentationID$$Number%08d$.m4f?pbs=364227c83ab745a19bf72c8748bb8aa3&drm=1&cloud=aws&si=0" startNumber="0" timescale="90000"></SegmentTemplate> </Representation>
init: E_init.mp4
segments: E00000000.m4f, E00000001.m4f, E00000002.m4f, ... , E00000618.m4f
i tried and in total it's about 952mb
concat them all together and decrypt with the key that's paired with kid 3a48357b1e694004a859475e6052b71cLast edited by tamagoyaki; 13th May 2021 at 03:22.
Similar Threads
-
Help with merging.
By DaveB69 in forum DVD RippingReplies: 10Last Post: 14th Nov 2021, 12:46 -
Merging mp4s
By Chris Newbold in forum Video ConversionReplies: 0Last Post: 1st Jan 2021, 11:20 -
Merging Layers?
By WreckinPoints11 in forum Newbie / General discussionsReplies: 1Last Post: 4th Jun 2020, 16:40 -
Problem with merging
By HanaHeart in forum Video ConversionReplies: 2Last Post: 1st Sep 2018, 17:58 -
Merging sources
By Akai-Shuichi in forum RestorationReplies: 2Last Post: 22nd Nov 2016, 19:12