VideoHelp Forum




Results 1 to 9 of 9
  1. Member
    Join Date
    Oct 2007
    Location
    Italy
    Search Comp PM
    Hi, I have a compact camera which can record 640x480 30fps MPEG movies with audio, and I'd like to recompress those movies into Divx/MPEG4 before archiving to save disk space.
    I'm trying to do this with ffmpegX 0.0.9x r2, but the resulting AVI file has audio slightly out of sync (maybe it starts ok but soon goes out of sync, I still didn't check this but the effect is easily noticeable even in a 10 seconds movie). I do this on a G4 iBook.

    This also happens with the default settings: I drop an AVI file, as spitted out from my camera, on ffmpegX's source area; ffmpegX identifies it as AVI, with video "mjpeg, yuvj422p, 640x480" and audio "pcm_u8, 16000 Hz, mono, 128 kb/s", and automatically sets the output to AVI DivX, with video "ffmpeg mpeg4, 640x480, 1500 kbps, 29.97 fps, no crop" and audio "mp3, 16000 Hz, 64 kbps"; I then just run the encoding, it completes, I open the resulting file with VLC and the audio is/becomes out of sync.
    I'll attach the ffmpegX log below for a 10 seconds movie.

    I then discovered that I can work around the issue by opening the Audio tab in ffmpegX and changing the audio codec from "MP3" to "Passthrough", but I'd prefer to stick to MP3 to create more "standard" Divx files.

    Any clues on why this happens and how to prevent it?
    On a side note, any other free/shareware alternatives out there for doing this kind of operation on a PPC Mac?
    Thanks.

    Code:
    Encoding started on Sun Oct  7 20:31:39 CEST 2007
    MEncoder dev-CVS-051126-18:35-3.3 (C) 2000-2005 MPlayer Team
    Mac OSX static build for ffmpegX
    AltiVec found
    CPU: PowerPC
    success: format: 0  data: 0x0 - 0xb29612
    AVI file format detected.
    VIDEO:  [MJPG]  640x480  24bpp  30.000 fps  9217.7 kbps (1125.2 kbyte/s)
    [V] filefmt:3  fourcc:0x47504A4D  size:640x480  fps:30.00  ftime:=0.0333
    ==========================================================================
    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    AUDIO: 16000 Hz, 1 ch, u8, 128.0 kbit/100.00% (ratio: 16000->16000)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    ==========================================================================
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    Opening video filter: [scale w=640 h=480]
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
    ==========================================================================
    Forcing output fourcc to 58564944 [XVID]
    Building audio filter chain for 16000Hz/1ch/u8 -> 48000Hz/0ch/s8...
    Building audio filter chain for 16000Hz/1ch/u8 -> 48000Hz/1ch/s16be...
    VDec: vo config request - 640 x 480 (preferred colorspace: Planar 422P)
    VDec: using Planar 422P as output csp (no 1)
    Movie-Aspect is undefined - no prescaling applied.
    SwScaler: FAST_BILINEAR scaler, from Planar 422P to Planar YV12 using AltiVec
    videocodec: libavcodec (640x480 fourcc=58564944 [XVID])
    Writing AVI header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Skipping frame!
    Flushing video frames
    Writing AVI index...
    Fixing AVI header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Video stream: 1050.627 kbit/s  (131328 B/s)  size: 1222576 bytes  9.309 secs  300 frames
    Audio stream:  128.000 kbit/s  (15999 B/s)  size: 157056 bytes  9.816 secs
    Encoding completed on Sun Oct  7 20:31:59 CEST 2007

  2. Explorer Case's Avatar
    Join Date
    Feb 2004
    Location
    Middle Earth
    Search Comp PM
    Originally Posted by starless
    MPEG movie
    Code:
    AVI file format detected. 
    VIDEO:  [MJPG]
    MJPG AVI is not MPEG.

    Originally Posted by starless
    to video ffmpeg mpeg4
    Code:
    MEncoder dev-CVS-051126-18:35-3.3 (C) 2000-2005 MPlayer Team
    Your log shows using the mencoder engine, not the ffmpeg engine.

    Try using the ffmpeg engine in combination with Decoding with QT (Options tab). Using QuickTime within ffmpegX has a good chance of keeping sync.

  3. Member
    Join Date
    Aug 2005
    Location
    Palo Alto, California USA
    Search Comp PM
    And as to *why* this might be happening, here's my guess: Your video bitrate is a little bit on the high side, at 9Mb/s. At that rate, dropped frames are not all that improbable, depending on the details of your computer and I/O (as well as on what other tasks your computer was doing during the capture). The video frames will get dropped, but the audio will probably keep right on going.

    Case's suggestion of using QT is your best hope -- QT tends to do a better job than mplayer of disentangling problems caused by dropped source frames.

  4. Member
    Join Date
    Oct 2007
    Location
    Italy
    Search Comp PM
    Case:
    sorry, I thought "Motion JPEG" was the same as "MPEG".
    In the example I was using the mencoder engine because it's the default ffmpegX setting. I already tried using ffmpeg and decoding with QT, the result seems to be in sync, but it has HUGE differences in file size, at least with the default settings: starting from a 11.2 MB AVI file, using mencoder I get a 1.3 MB file, while using ffmpeg I get a 8.8 MB file! And the video quality appears to be the same! This doesn't make it worth the conversion to save disk space, which was my intention.

    tomlee59:
    thanks for the guess, but IMHO it doesn't make much sense; I do not do any real "capture", I just transfer the plain AVI file from my camera to my Mac. So I can't see how it might be dropping frames... and then, why does the original file play fine and synced in all players?

  5. Member
    Join Date
    Aug 2005
    Location
    Palo Alto, California USA
    Search Comp PM
    So it was a bad guess.

    I'm curious as to the filesize difference you mention. If you chose the same target bitrate in both cases, the resulting filesizes should have been pretty much equal. Did you specify a target bitrate, or did you just drag, drop and go? If the latter, try specifying the target parameters explicitly. With xvid at, say, 1Mbit/s, you should have a reasonable balance between filesize and quality. A 10-second clip should then be about 1.X MB in size.

    As to mjpeg vs. mpeg, they are similar, but different. Mjpeg is essentially a sequence of jpeg still images; each frame is totally independent of all other frames. Mpeg goes further in order to reduce filesize. It exploits the similarity from frame to frame and effectively generates interpolated frames (this interpolation is periodically reset by throwing in a totally independent standalone frame). Fewer bits are needed to encode differences between similar frames, so the compression factor is higher. However, computational complexity goes up, because now frames can depend on other frames. Mjpeg is simpler, so many cameras implement that, at the cost of somewhat bloated filesize.

  6. Member
    Join Date
    Oct 2007
    Location
    Italy
    Search Comp PM
    Originally Posted by tomlee59
    I'm curious as to the filesize difference you mention. If you chose the same target bitrate in both cases, the resulting filesizes should have been pretty much equal. Did you specify a target bitrate, or did you just drag, drop and go? If the latter, try specifying the target parameters explicitly. With xvid at, say, 1Mbit/s, you should have a reasonable balance between filesize and quality. A 10-second clip should then be about 1.X MB in size.
    Well, first of all, I'm not talking about xvid... I'm talking about divx, namely the "MPEG4 [.AVI]" settings in ffmpegX's video tab, which it sets by default, or the DivX ffmpeg/mencoder options in the summary page, which is the same.
    And I think I both tried using the two default settings, and then also using the first default setting and then just changing the encoder, so the bitrate should have stayed the same.

    Anyway I tried again now, and discovered the the size is bloated when using the "Decode with QT" option!
    Starting with the same 10s clip, the default DivX mencoder setting creates a 1.4 MB file, while the default DivX ffmpeg settings go up to 1.5 MB, and simply activating the QT option in the latter case bloats it to 8.3 MB!

    Anyway, the ffmpeg settings seem to create a finely synced file, even without the QT option, so that was a useful test .

    Originally Posted by tomlee59
    As to mjpeg vs. mpeg, they are similar, but different. Mjpeg is essentially a sequence of jpeg still images;
    Ok thanks. I know MPEG quite well, but never found out what MJPEG was.

  7. Member
    Join Date
    Aug 2005
    Location
    Palo Alto, California USA
    Search Comp PM
    Originally Posted by starless
    Well, first of all, I'm not talking about xvid... I'm talking about divx, namely the "MPEG4 [.AVI]" settings in ffmpegX's video tab
    According to the logfile output you posted, it seems that ffmpegx is using xvid:

    Forcing output fourcc to 58564944 [XVID]
    Building audio filter chain for 16000Hz/1ch/u8 -> 48000Hz/0ch/s8...
    Building audio filter chain for 16000Hz/1ch/u8 -> 48000Hz/1ch/s16be...
    VDec: vo config request - 640 x 480 (preferred colorspace: Planar 422P)
    VDec: using Planar 422P as output csp (no 1)
    Movie-Aspect is undefined - no prescaling applied.
    SwScaler: FAST_BILINEAR scaler, from Planar 422P to Planar YV12 using AltiVec
    videocodec: libavcodec (640x480 fourcc=58564944 [XVID])

    That's why I mentioned xvid in my post.

    But in any case, I'm very glad that you got things to work!

  8. Member
    Join Date
    Oct 2007
    Location
    Italy
    Search Comp PM
    Originally Posted by tomlee59
    According to the logfile output you posted, it seems that ffmpegx is using xvid:
    Oh well, you are right, that's very strange! But this is actually the way it works... I just tried again by dropping the same test movie on the source area, and a first interesting thing is that this time the default output setting chosen by ffmpegX was "mencoder mpeg4" at 940 kbps, while in the previous test I reported it was "ffmpeg mpeg4" at 1500 kbps, who knows! Maybe the first time I had not just opened the program and dropped, but maybe changed other settings first, and when drag&dropping the file not all defaults are restored... Anyway, even in this new test, the log showed exactly the same XVID hints, although the summary page shows "AVI DivX" in big black chars as the output, and the video tab is set to "MPEG4 [.AVI] (mencoder)".

    Does anyone have any clue why the log shows XVID instead? What's more, if I open the resulting file with VLC and look at the stream info window, it correctly appears to be a DivX movie...

  9. Explorer Case's Avatar
    Join Date
    Feb 2004
    Location
    Middle Earth
    Search Comp PM
    Originally Posted by starless
    Does anyone have any clue why the log shows XVID instead?
    It's a mencoder thing for the log only. No idea what spelling backwards here is good for, tho'... The number 58564944 (58-56-49-44) is hexadecimal for XVID. But the encoder writes 'DIVX' as identifier into the AVI.




Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!