LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-07-2008, 10:59 AM   #1
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Rep: Reputation: 0
MJPEG movie to JPEG without quality loss


My camera produces movies in MJPEG format with audio. With some of these I have filmed them in portrait rather than landscape and so when played they are the wrong way round. I would like to rotate them.

It is my understanding that MJPEGs are just made up of JPEG images and so one should be able to extract the JPEGs, rotate them using jpegtran and then put them back together, combining them with the audio.

Anyone got any idea or a simple script to do this.

I was looking at mplayer/mencoder but this reduces the quality.
 
Old 07-07-2008, 11:38 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Is MJPEG really just a series of JPEGS - effectively every frame being a key frame? If so then it might be possible. If not then I think it's inevitable that you will have quality loss.
 
Old 07-07-2008, 11:45 AM   #3
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
This is what wikipedia says:

"In multimedia, Motion JPEG (M-JPEG) is an informal name for multimedia formats where each video frame or interlaced field of a digital video sequence is separately compressed as a JPEG image"

I should say that the container is an AVI.
 
Old 07-07-2008, 12:11 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
What mplayer / mencoder commands are you using?
 
Old 07-08-2008, 07:29 AM   #5
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
I'm not using mplayer/mencoder as they would decompress the jpegs and then recompress.

I am getting somewhere using http://pieleric.free.fr/junk/mjpgrot and the almara tools.

The only problem I have is that the resulting movie cannot not be played by mplayer. This is the output of the rotated movie:

VDec: vo config request - 480 x 640 (preferred colorspace: Unknown 0x0000)
[PP] Using external postprocessing filter, max q = 6.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.

Compared to the unrotated movie:
VDec: vo config request - 640 x 480 (preferred colorspace: Planar 422P)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar 422P as output csp (no 1)

I have isolated the problem to the jpegtran rotation step, it seems that after a jpeg is rotated (other transformations do not do this) it losses its color space and can not be opened by mplayer.

Any ideas?
 
Old 07-08-2008, 07:33 AM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
none, sorry.
 
Old 07-08-2008, 08:48 AM   #7
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,095
Blog Entries: 2

Rep: Reputation: 111Reputation: 111
You can rotate them during playback with mplayer with -vf rotate=1 (90 clockwise, man page shows a few other values for rotate). I know this doesn't give you a permanent change, but at least you would be able to watch them.
 
  


Reply

Tags
rotate


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Quality Loss Raeth Linux - Hardware 1 02-05-2007 05:29 PM
MJPEG in Cinelerra? danielson Linux - Software 3 03-19-2006 04:25 PM
What are MJPEG-tools? How do I use them? rrrssssss Linux - Software 1 11-20-2005 07:41 AM
MJPEG support? davecs Linux - General 0 06-24-2003 04:31 PM


All times are GMT -5. The time now is 03:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration