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 > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th January 2015, 07:26   #1  |  Link
mustardman
Registered User
 
Join Date: Dec 2002
Location: Australia
Posts: 264
Rotating video without re-encoding (MP4 etc).

Before anyone jumps down my throat, I have done a global search on the doom9 forums, and have come across nothing of use.

It seems a common question to ask, but it also seems to be one that is quite elusive : rotating video (by multiples of 90deg) just like a JPG still can be rotated - without re-encoding.

I have searched wider, and there is a tool to rotate MJPEG losslessly, and there also seem to be a few tools that claim to rotate MP4 video losslessly (VideoGo, Video Cutter). However, it seems exceedingly unclear whether this process simply changes the way the video is displayed by the player (setting a 'display' flag in the stream), or actually rotating the video data in the stream itself.

Personally, I suspect the former. Rotating MJPEG is really a step up from rotating a single JPG image, but rotating a stream with any sort of past/future frame references would be hard.

Do any readers with superior knowledge on this subject have a definitave answer on this one?

Thanks,
MM
mustardman is offline   Reply With Quote
Old 26th January 2015, 14:47   #2  |  Link
Warperus
Registered User
 
Join Date: Apr 2010
Location: Sain-Petersburg, Russia
Posts: 140
I've not seen any rotation flag in H.264 stream.
But macroblocks follow raster order, pictures are filled from left to right, from top to bottom. Intra prediction uses left and upper part of slice counting from current macroblock.
I don't think rotation with such limitations is possible in lossless mode unless file size grows by times.
Counting references to previous frames/blocks looks doable, but file size can grow a bit as well.
Warperus is offline   Reply With Quote
Old 26th January 2015, 19:11   #3  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,702
Quote:
Originally Posted by mustardman View Post
I have searched wider, and there is a tool to rotate MJPEG losslessly, and there also seem to be a few tools that claim to rotate MP4 video losslessly (VideoGo, Video Cutter). However, it seems exceedingly unclear whether this process simply changes the way the video is displayed by the player (setting a 'display' flag in the stream), or actually rotating the video data in the stream itself.

Personally, I suspect the former. Rotating MJPEG is really a step up from rotating a single JPG image, but rotating a stream with any sort of past/future frame references would be hard.
There is a non-standard flag (not well respected) for rotating video in MP4 but there is no way to rotate H.264 video losslessly. I am assuming H.264/AVC is what is inside your MP4?
Asmodian is offline   Reply With Quote
Old 26th January 2015, 21:47   #4  |  Link
mustardman
Registered User
 
Join Date: Dec 2002
Location: Australia
Posts: 264
In actual fact my video's are not MP4 (generally speaking). I have video from several different brands of 'still' cameras, which include AVI and MOV : i have not looked further into the specific codecs they use.

I started by doing a search for "rotate video lossless" on google, and apart from MJPEG, I found nothing concrete. A lot of people (forum posts here and there) claimed "no", but then quite a few claimed "yes" for MP4. Additionally I came across a single thread that talked about rotating quicktime without re-encoding, but different posters seemed to have varying success with that.

So I checked out the home pages for the tools mentioned, and the claim is made pretty clearly there as well (lossless MP4 rotation). But there was nothing on how the process is implemented, either on the home pages or in forums.

MM
mustardman is offline   Reply With Quote
Old 26th January 2015, 21:49   #5  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 9,833
You can't rotate MP4 as such, you can only put a flag into the MP4 that tells the player to rotate the video during playback. However, as others have indicated before, its not that well supported.
MJPG might be the only codec where this works properly due to lossless jpeg rotation.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Reply

Tags
lossless, mjpeg, mp4, rotate

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 07:02.


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