Log in

View Full Version : I can't MJPEG -> x264 ?


niv
13th March 2005, 02:23
I have a MJPEG file without sound.

L:\testin.avi.post.avs reads:
SetMemoryMax(40)
AVISource("L:\testin.avi.MJPG.avi")


I asked to:
>avs2yuv "L:\testin.avi.post.avs" -o - | mencoder - -nosound - -o NUL: -ovc x264 -x264encopts pass=1:bitrate=491 -passlogfile L:\testin.avi.video.pass"

got this:
MEncoder dev-CVS-050305-18:27-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

84 audio & 192 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
L:\testin.avi.post.avs: 512x384, 5000000/199957 fps, 14999 frames
converting YUY2 -> YV12
YUV4MPEG2 file format detected.
YUV4MPEG2 Video stream 0 size: display: 512x384, codec: 512x384
VIDEO: [YV12] 512x384 12bpp 25.005 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:12 fourcc:0x32315659 size:512x384 fps:25.01 ftime:=0.0400
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 512 x 384 (preferred csp: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
x264 [info]: no need for a SAR
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
Selected video codec: [rawyv12] vfm:raw (RAW YV12)
==========================================================================
Writing AVI header...
ODML: vprp aspect is 4:3.
ODML: vprp aspect is 4:3.
x264 [warning]: buffer underflow -22020 0min 0mb A-V:0.000 [491:0]
x264 [warning]: buffer underflow -8407 0min 0mb A-V:0.000 [491:0]
x264 [warning]: buffer underflow -19156 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -5151 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -17425 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -18818 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -9621 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -31738 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -25749 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -35604 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -10258 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -6916 0min 0mb A-V:0.000 [492:0]
Reading from stdin... 0%) 8fps Trem: 0min 0mb A-V:0.000 [492:0]
success: format: 0 data: 0x0 - 0x0
============ Sorry, this file format is not recognized/supported =============
=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===
Cannot open demuxer.

Exiting...

What did I do wrong?
I am recording to MJPEG then filtering to MJPEG to get the testin.avi.MJPG.avi file. can I save to MJPEG with the colorspave X264 needs? should I use a different loseless format?

Niv

celtic_druid
13th March 2005, 03:28
Try mencoder L:\testin.avi.MJPG.avi -nosound -o NUL: -ovc x264 -x264encopts pass=1:bitrate=491 -passlogfile L:\testin.avi.video.pass"

mencoder can handle MJPEG by itself.

Also, haven't tried it myself but x264.exe should now accept avi and avs input directly.

niv
14th March 2005, 14:30
G:\Program Files\mplayer>mencoder "L:\Regulars\60_MIN.AVI.MJPG.avi" -o NUL: -ovc
x264 -x264encopts pass=1:bitrate=491 -passlogfile "L:\Regulars\60_MIN.AVI.video
.pass"
MEncoder dev-CVS-050305-18:27-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

84 audio & 192 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
success: format: 0 data: 0x0 - 0x0
AVI file format detected.
AVI: No audio stream found -> no sound.
VIDEO: [MJPG] 512x384 24bpp 25.000 fps 4732.4 kbps (577.7 kbyte/s)
[V] filefmt:3 fourcc:0x47504A4D size:512x384 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

I am attaching a picture of the source details (any way to output the details to a txt file?)

niv
14th March 2005, 14:34
that I used this AVS file to create the MJPEG that didn't work with mencoder:
SetMemoryMax(40)
AVISource("L:\Regulars\60_MIN.AVI")
GuavaComb("PAL")
PeachSmoother()
Telecide(order=1,guide=2,post=2,vthresh=25)
BicubicResize(512,384)
Undot()
Levels(0,1.15,255,0,255)

hellfred
14th March 2005, 17:05
Originally posted by niv
[I]
I asked to:
>avs2yuv "L:\testin.avi.post.avs" -o - | mencoder - -nosound - -o NUL: -ovc x264 -x264encopts pass=1:bitrate=491 -passlogfile L:\testin.avi.video.pass"

Isn't there a dash too much after mencoder
mencoder >-< -nosound >-< -o null ...
Look here (http://students.washington.edu/lorenm/src/avisynth/avs2yuv/) for an example commandline:
Sample usage:
wine avs2yuv.exe foo.avs - | mencoder - -o hfyu.avi -ovc lavc -lavcopts vcodec=ffvhuff:vstrict=-1:pred=2:context=1
And you can leave out the -o after avs2yuv.exe
Hellfred

EDIT: Disabled smilies

niv
16th March 2005, 21:18
I:\Scripts\Video_scripting>avs2yuv "L:\THE_WEST_WING.AVI.post.avs" -o - | "g:\
Program Files\mplayer\mencoder" - -nosound - -o NUL: -ovc x264 -x264encopts pass
=1:bitrate=491 -passlogfile "L:\THE_WEST_WING.AVI.video.pass"
MEncoder dev-CVS-050315-21:39-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

85 audio & 192 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
L:\THE_WEST_WING.AVI.post.avs: 484x56, 24 fps, 240 frames
converting YUY2 -> YV12
YUV4MPEG2 file format detected.
YUV4MPEG2 Video stream 0 size: display: 484x56, codec: 484x56
VIDEO: [YV12] 484x56 12bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:12 fourcc:0x32315659 size:484x56 fps:24.00 ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 484 x 56 (preferred csp: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
x264 [error]: width % 16 != 0 or height % 16 != 0 (484x56)
x264_encoder_open failed.
FATAL: Cannot initialize video driver.
VDecoder init failed :(
Cannot find codec matching selected -vo and video format 0x32315659.
Read DOCS/HTML/en/codecs.html!
==========================================================================

Exiting...
Output error: wrote only 39028 of 40656 bytes

celtic_druid
16th March 2005, 23:52
In the last case there is a problem with your AVISynth script. AVISynth errors are ???x56.

niv
17th March 2005, 00:09
seems that I might have forgot a digit and the pre process.
now it seems to work fine using the avs2yuv piping way.

However the direct way of converting mjpeg to AVC still crashs.
the same file that works with the avs2yuv crashs if called directly:

C:\Documents and Settings\niv>"g:\Program Files\mplayer\mencoder.exe" -nosound L
:\Capture.avi.MJPG.avi -o NUL: -ovc x264 -x264encopts pass=1:bitrate=491 -passlo
gfile l:\testing.pass
MEncoder dev-CVS-050315-21:39-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

85 audio & 192 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
success: format: 0 data: 0x0 - 0x655e2000
AVI file format detected.
AVI_NI: No audio stream found -> no sound.
VIDEO: [MJPG] 512x384 24bpp 25.017 fps 15113.1 kbps (1844.9 kbyte/s)
[V] filefmt:3 fourcc:0x47504A4D size:512x384 fps:25.02 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

and a crash.

How can I make some sort of log to help debug this?

niv
17th March 2005, 09:35
I still can't encode to AVC:

I:\Scripts\Video_scripting>avs2avi "L:\Capture.avi.pre.avs" "L:\Capture.avi.MJ
.avi" -c MJPG -p 0 -w

AVS2AVI v1.39 (c) 2002-2004:
Christophe Paris, David Leatherdale, int21h, Moitah
http://www.avs2avi.org/

Source:
* Filename: "L:\Capture.avi.pre.avs"
* FourCC: YUY2
* Frames: 22514
* Resolution: 512x384
* Frame rate: 25.017 FPS
Compressor:
* Name: PICVideo MJPEG Codec
* FourCC: mjpg
Destination:
* Filename: "L:\Capture.avi.MJPG.avi"
* Pass 1/1: Finished in 01:05:35.081 (5.72 FPS)
* Frames: 22514 (22514 keyframes)
* Size: 1621.88 MB

I:\Scripts\Video_scripting>if not exist "L:\Capture.avi.MJPG.avi" goto pre-err

I:\Scripts\Video_scripting>date /T 1>>"L:\Capture.avi.log"

I:\Scripts\Video_scripting>time /T 1>>"L:\Capture.avi.log"

I:\Scripts\Video_scripting>echo SetMemoryMax(40) 1>"L:\Capture.avi.post.avs"

I:\Scripts\Video_scripting>echo AVISource("L:\Capture.avi.MJPG.avi") 1>>"L:\Capture.avi.post.avs"

I:\Scripts\Video_scripting>goto pass1_encode

I:\Scripts\Video_scripting>pushd

I:\Scripts\Video_scripting>avs2yuv "L:\Capture.avi.post.avs" -o - | "g:\Prog
m Files\mplayer\mencoder" - -nosound - -o NUL: -ovc x264 -x264encopts pass=1:b
rate=491 -passlogfile "L:\Capture.avi.video.pass"
MEncoder dev-CVS-050315-21:39-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

85 audio & 192 video codecs
File not found: 'frameno.avi'
File not found: 'frameno.avi'
Failed to open frameno.avi
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
L:\Capture.avi.post.avs: 512x384, 400000/15989 fps, 22514 frames
converting YUY2 -> YV12
YUV4MPEG2 file format detected.
YUV4MPEG2 Video stream 0 size: display: 512x384, codec: 512x384
VIDEO: [YV12] 512x384 12bpp 25.017 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:12 fourcc:0x32315659 size:512x384 fps:25.02 ftime:=0.0400
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 512 x 384 (preferred csp: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
x264 [info]: no need for a SAR
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
Selected video codec: [rawyv12] vfm:raw (RAW YV12)
==========================================================================
Writing AVI header...
ODML: vprp aspect is 4:3.
x264 [warning]: buffer underflow -14724
ODML: vprp aspect is 4:3.
x264 [warning]: buffer underflow -58826 0min 0mb A-V:0.000 [491:0]
x264 [warning]: buffer underflow -72404 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -34380 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -23844 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -41372 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -7158 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -6454 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -14328 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -9676 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -24798 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -13630 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -642: 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -17168 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -900: 0min 0mb A-V:0.000 [493:0]
x264 [warning]: buffer underflow -11572 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -3958 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -17230 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -23180 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -2038 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -27550 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -3242 0min 0mb A-V:0.000 [492:0]
x264 [warning]: buffer underflow -5560 0min 0mb A-V:0.000 [492:0]
Reading from stdin... 0%) 8fps Trem: 0min 0mb A-V:0.000 [492:0]
Reading from stdin... 0%) 8fps Trem: 0min 0mb A-V:0.000 [492:0]
success: format: 0 data: 0x0 - 0x0
============ Sorry, this file format is not recognized/supported =============
=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===
Cannot open demuxer.

Exiting...

akupenguin
17th March 2005, 10:32
Originally posted by niv
avs2yuv "L:\Capture.avi.post.avs" -o - | "g:\Program Files\mplayer\mencoder" - -nosound - -o NUL: -ovc x264 -x264encopts pass=1:bitrate=491 -passlogfile "L:\Capture.avi.video.pass"

There are two "-"s in your mencoder commandline. Until recently that wouldn't have mattered, but now mencoder supports multiple input files. So after it finishes encoding the video, it moves on to the second "-", and tries reading from stdin again. avs2yuv has finished, so theres nothing to read, which is what it complained about.

niv
17th March 2005, 10:50
I:\Scripts\Video_scripting>avs2avi "L:\Capture.avi.post.avs" "L:\Capture.avi.2.a
vi" -c x264 -p 0 -w

AVS2AVI v1.39 (c) 2002-2004:
Christophe Paris, David Leatherdale, int21h, Moitah
http://www.avs2avi.org/

Source:
* Filename: "L:\Capture.avi.post.avs"
* FourCC: YUY2
* Frames: 22514
* Resolution: 512x384
* Frame rate: 25.017 FPS
Compressor:
* Name: x264 - H264/AVC encoder
* FourCC: X264
Destination:
* Filename: "L:\Capture.avi.2.avi"
* Pass 1/1: Frame 1/22514, 0 B, 0.00 FPS, ETA
ICSeqCompressFrameStart failed : The operation completed successfully.

* Pass 1/1: Frame 2/22514, 0 B, 0.00 FPS, ETA
I:\Scripts\Video_scripting>if not exist "L:\Capture.avi.video.pass" goto first_e
rr
error in 1st pass

"L:\Capture.avi.post.avs" :
SetMemoryMax(40)
AVISource("L:\Capture.avi.MJPG.avi")

niv
17th March 2005, 13:15
You got it right!
that explains a whole load of shit.

As I am far from the PC that does the capturing and encoding I am remote controling it (VNC). Now I realize that I better edit the scripts from here and send it there, rather then edit it on the remote pc.

the screen update isn't that good...

the AVS2avi still won't boudgh...

niv
20th March 2005, 15:25
good news is mencoder reads avisynth files fine, so no need for avs2yuv piping.
However I can't run mencoder stright from a mjpeg avi file:
C:\Documents and Settings\niv>"g:\Program Files\mplayer\mencoder.exe" -nosound "
L:\DAUTGHER_FATHER.AVI.mjpg.avi" -o NUL: -ovc x264 -x264encopts pass=1:bitrate=
491 -passlogfile "L:\tet.stat"
MEncoder dev-CVS-050315-21:39-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

85 audio & 192 video codecs
File not found: 'frameno.avi'
Failed to open frameno.avi
success: format: 0 data: 0x0 - 0x0
AVI file format detected.
VIDEO: [MJPG] 512x384 24bpp 25.000 fps 2810.9 kbps (343.1 kbyte/s)
[V] filefmt:3 fourcc:0x47504A4D size:512x384 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"

and mencoder crashs.

Niv