Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 6th July 2018, 16:02   #5241  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 3,645
Changing the display aspect ratio is basically the only such operation that you can do in Matroska without reencoding the video.
__________________
Latest MKVToolNix is v25.0.0

If I ever ask you to upload something, please use my FTP server.
Mosu is offline  
Old 10th July 2018, 18:36   #5242  |  Link
gpower2
Yet another Doom9 member
 
gpower2's Avatar
 
Join Date: Aug 2003
Location: Greece / Thessaloniki
Posts: 183
Hey guys! I have a question for the experts:
A friend of mine was hit by a ransomware and lost a lot of his files. He is interested in a particular mkv file which seems to only have its first bytes encrypted, meaning the mkv header is totally corrupted, yet the track data remain intact.
Is there a way to extract the tracks of that damaged mkv, or recreate the mkv header?

Thanks!
__________________
Gp2 says: Don't be a fool, just be cool :D !
gpower2 is offline  
Old 10th July 2018, 18:56   #5243  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 3,645
If they know the codec type and order of tracks, they could create a second file with the same track types and track order. Then use a hex editor and combine the track headers (everything before the first cluster) from the second file with the clusters from the encrypted file.

One problem will be CodecPrivate content. This won't be 100% identical in the second file you've created. However, you might get away with additional steps:
  1. Extract the video track from the combined file with "--raw"
  2. Remux that extracted data with mkvmerge

This might work if it's h.264 or h.265 and the SPS/PPS are part of the bitstream as mkvmerge will then be able to re-create the CodecPrivate from the bitstream.

Things get somewhat more complicated with AAC and CodecPrivate. In that case I'd try hard to simply get an audio track to mux with the same stream parameters (number of channels, sample rate, profile) and use the resulting track headers.

After all, they should start making regular backups — the best insurance against data loss of any kind, including crypto ransomware.
__________________
Latest MKVToolNix is v25.0.0

If I ever ask you to upload something, please use my FTP server.
Mosu is offline  
Old 11th July 2018, 08:18   #5244  |  Link
MrVideo
Registered User
 
MrVideo's Avatar
 
Join Date: May 2007
Location: Wisconsin
Posts: 1,349
Quote:
Originally Posted by Perenista View Post
I assumed that since this sort of modification is possible (while mantaining the contents in lossless) I could easily turn the video 90 degrees clockwise without any unnecessary reencode.
I get the feeling that you do not understand how video works. The video image that is encoded into MPEG-2, H.264 and H.265 (the common codecs that consumers basically use), "scan" from top to bottom, left to right. The aspect ratio is only a "tag" that tells the displaying device how the "pixels" are to be displayed. The decoding of the video is done top to bottom, left to right. Think of the old analog video displays. Same concept, just done with pixels.

The iPad, or any video recording device, does top to bottom, left to right, as if you were holding the recording device landscape. Hence, when you play back your portrait mode video, it looks like you shot it while laying on your side. The only way to "fix" it is to recode it and adding pillar bars on the sides. The vertical resolution is also reduced because the 1920 pixels have to be reduced to 1080 pixels. The horizontal resolution has to be reduced to 607 pixels in order to keep the 9:16 aspect ratio. That is why all these idiots (IMHO) who shoot video with their cell phones result in there being pillar bars of some sort on the left and right. Things are fine if you only view the video on your cell phone, but contribute the video to a TV station and it looks like crap (IMHO). I even harp on my daughter when she sends me vertically shot video.

Sorry, but your video is frack'd.
__________________
My Total Eclipse 2017 Photos
MrVideo is offline  
Old 11th July 2018, 10:04   #5245  |  Link
mkver
Registered User
 
Join Date: May 2016
Posts: 87
Quote:
Originally Posted by MrVideo View Post
The only way to "fix" it is to recode it and adding pillar bars on the sides.
There is another way:
1. If your video is H.264, you can add a "Display Orientation SEI message" into the bitstream that contains the information that this video should be turned by 90 when viewed.
2. You can use a container that allows you to rotate the video. mp4 does so (you have to set the right "matrix"), Matroska unfortunately not.
Both these approaches have a downside: They only work on players that take this side-data into account. The second approach seems to work with ffmpeg-based players; the first seems not to do so. (I haven't seen a player that actually honours these SEI values.)
mkver is online now  
Old 11th July 2018, 16:04   #5246  |  Link
SeeMoreDigital
Life looks better in UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,290
Provide an AVC encoded sample and I'll make it play back at any aspect ratio you like?!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

Last edited by SeeMoreDigital; 11th July 2018 at 16:08.
SeeMoreDigital is offline  
Old 12th July 2018, 20:24   #5247  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 3,645
MKVToolNix v25 released

MKVToolNix v25 has been released. There's a new thread for that as I cannot change the title of this one anymore — this thread is simply too old. Please head over to the new thread. This one will be closed soonish. Thanks!
__________________
Latest MKVToolNix is v25.0.0

If I ever ask you to upload something, please use my FTP server.
Mosu is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.