LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-12-2005, 10:49 AM   #1
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Rep: Reputation: 15
Question mencoder problem converting *.jpg to .avi


I am running ubuntu 5.04, and want to convert a series of JPEG snapshots taken from an internet camera into a "movie" file. The output format isn't critical - mpeg, xvid, quicktime, mjpeg - I really don't care, anything viewable from mplayer or xine is fine.

I'm trying to get mencoder to do this, since it claims it can, and while the most recent version number 1.0pre7-3.3.5 compiles and executes normally, the output movie flickers and crashes mplayer. Xine only flickers. By flicker, I mean it displays a black frame between every video frame. Doesn't seem to matter what video codec I use, the result is nearly identical.

I also tried using the mencoder deb package that is available under Ubuntu's Synaptic package manager, but that older version of mencoder crashes with Segmentation Fault when it comes time to write the output file.

Does anyone know how I can get this to work? The command line options I'm using come straight from the examples in the man page and other documents.

Or does anyone know of some other Linux package I can use to perform this task?

Thanks in advance!



Here's the command line I'm using:

/usr/local/bin/mencoder mf://*.jpg -mf type=jpg \
-ovc lavc -lavcopts vcodec=mpeg2video:aspect=4/3 \
-o Test.avi


And here's the output that command generates:

MEncoder 1.0pre7-3.3.5 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon 4 /Athlon MP/XP Palomino (Family: 6, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

File not found: 'frameno.avi'
Failed to open frameno.avi
success: format: 16 data: 0x0 - 0x0
[demuxer] mf support.
[mf] search expr: *.jpg
[mf] number of files: 36 (144)
VIDEO: [IJPG] 0x0 24bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:16 fourcc:0x47504A49 size:0x0 fps:25.00 ftime:=0.0400
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm:ffmpeg (FFmpeg MJPEG decoder)
==========================================================================
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
VDec: vo config request - 640 x 480 (preferred csp: Planar 422P)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar 422P as output csp (no 1)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: reducing / aligning filtersize 1 -> 4
SwScaler: reducing / aligning filtersize 1 -> 4
SwScaler: reducing / aligning filtersize 1 -> 1
SwScaler: reducing / aligning filtersize 9 -> 8

SwScaler: BICUBIC scaler, from Planar 422P to Planar YV12 using MMX2
videocodec: libavcodec (640x480 fourcc=3267706d [mpg2])
ODML: vprp aspect is 4:3.
Pos: 1.4s 36f ( 0%) 6fps Trem: 0min 0mb A-V:0.000 [4398:0]
Flushing video frames

Writing AVI index...
Fixing AVI header...
ODML: vprp aspect is 4:3.

Video stream: 4398.500 kbit/s (549812 bps) size: 791730 bytes 1.440 secs 36 frames
 
Old 05-12-2005, 11:38 AM   #2
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,176

Rep: Reputation: 54
I'm not certain, but it may be your choice of codec. Did you try with mpeg4? As example:
Code:
/usr/local/bin/mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o Test.avi
 
Old 05-12-2005, 12:38 PM   #3
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by m_yates
I'm not certain, but it may be your choice of codec. Did you try with mpeg4? As example:
Code:
/usr/local/bin/mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o Test.avi
Yes, I tried other codecs. xvid, mpeg4. No difference. Flicker still there.
 
Old 05-31-2005, 05:33 PM   #4
tencheese
LQ Newbie
 
Registered: May 2005
Posts: 1

Rep: Reputation: 0
I actually have a very similar problem. I am wanting to convert a large number of jpeg images to an AVI (or mpeg, anything, but preferably AVI) for playback on a Windows machine. But I am unable to play back any of the resulting movie files. I have also tried just about all of the output options. Usually I use the Windows machine for this process but I have more than a million jpegs in the sequence so I don't dare

I am using mencoder 1.0pre7 on linux-2.4.2 i586. Mencoder appeared to compile and install without problems, and the encode process throws up no errors. The resulting files have an unknown 4cc code of "FMP4" which I have not seen before and appears to be unheard of. I am using an identical command line to whistl.
 
Old 06-01-2005, 08:52 AM   #5
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
workaround found

I downloaded MJPEGTOOLS (http://mjpeg.sourceforge.net), and while reading it's docs, happened to learn that the Imagemagick "convert" tool is able to convert multiple jpeg images into an MNG format movie. Xine is able to play MNG movies (MNG is to PNG what MJPEG is to JPEG), so my problem is solved.

One of my friends found an MNG codec for windows on the net somewhere, and was able to view my movie on his windows box. Sorry, but I don't know where he got it, but you can try http://www.libpng.org/pub/mng/ or just google "MNG codec windows".
 
Old 06-26-2005, 01:53 PM   #6
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Fedora FC18, FC14, FC12
Posts: 222

Rep: Reputation: 29
Somehow I think this is related to a problem with the mf://*.jpg specification.

I have nearly a 1000 jpegs.

The first 100 frames of the rendered movie seem to alternate between a the first and a blank frame, then it switches to alternating between the first and a frame much further along. As the movie progresses, the frames slowly change but always are out of order.

I have submitted a bug report.

Mencoder seems the only option at this point. I tried convert and it blew out my system with overload. MS Moviemaker, croaks with this many files too.
 
Old 06-26-2005, 08:58 PM   #7
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
I was able to solve this problem using the ImageMagick "convert" utility and the MPEG2ENCODE utility, part of the MPEG2 reference codec, which can be downloaded from http://www.mpeg.org/ or ftp://ftp.mpegtv.com/pub/mpeg/mssg/m...dec_v12.tar.gz . It was easy to compile, and once installed, "convert" uses it with the "m2v" (mpeg2 video) type.

convert *.jpg m2v:movie.mpg

It does take a lot of resources to complete. Convert first translates every JPEG frame into YUV format (stored as temporary files in /tmp), and finally all the YUV frames are fed to mpeg2encode to create the .mpg movie file. On my AMD Sempron 2800 with 512 Mb RAM, converting 720 jpegs (640x480) to a MPEG2 movie takes 100% CPU, 1.5Gb virtual memory (it was paging like mad) and about 35 minutes clock time. I'm sure it would be a lot quicker, if I could afford a 2Gb RAM upgrade and separate SATA disk drives for the data and /tmp directories.

Good Luck!
 
Old 06-28-2005, 02:42 PM   #8
zestychen
LQ Newbie
 
Registered: Jun 2005
Posts: 2

Rep: Reputation: 0
If you can read this Whistl or anyone else with experience with ImageMagick, please help.

my email is frank78 [A T} gmail.com. Help is greatly appreciated. Basically I'm stuck in a bind of not enough documentation in regards to the writing of avis. I hope to use convert too, but am always "missing a codec". How would I go about obtaining the correct AVI codec for IM?
 
Old 06-29-2005, 07:35 AM   #9
whistl
Member
 
Registered: May 2005
Location: USA
Distribution: Ubuntu, CentOS
Posts: 37

Original Poster
Rep: Reputation: 15
Sorry, Imagemagick only has limited support for reading some AVI files, and none for writing them.

If you need AVI output, you'll have to find some other solution.
 
Old 06-29-2005, 01:32 PM   #10
zestychen
LQ Newbie
 
Registered: Jun 2005
Posts: 2

Rep: Reputation: 0
Thanks for the reply.

Actually, MPEG would be just as convinient. Do you think it would be possible to get your email? I am unsure about how to proceed in terms of compiling and using the MPEG2ENCODE tool you provided. I am rather new at Unix in general and would appreciate the help.
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting to .jpg format satimis Linux - General 15 02-08-2006 02:12 AM
mencoder mpegopts "not an option" format=dvd (converting avi to dvdauthor compliant) Emmanuel_uk Linux - Newbie 1 09-16-2005 01:52 PM
Turning a single JPG into a 10 second avi? nmoog Linux - Software 2 04-28-2004 06:58 AM
Converting avi to mpg OR creating an SVCD from an avi MasterC Linux - Software 5 03-28-2003 05:42 AM
.jpg to .avi ??? ddpicard Linux - General 7 12-07-2001 11:02 PM


All times are GMT -5. The time now is 07:48 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