2006-11-08

Encode Quicktime Movie from DC with x264 (82MB vs. 4.6MB)

  1. Input filesize vs. Output filesize (1 minute movie)
    -rw-r--r-- 1   4708697 2006-11-08 02:14 p1000010.avi
    -rw-r--r-- 1  84961874 2006-11-05 17:12 p1000001.mov
  2. The input quicktime movie from Digital Camera
    $ file p1000001.mov

    p1000001.mov: Apple QuickTime movie (unoptimized)

    $ tcprobe -i p1000001.mov
    [tcprobe] Apple QuickTime movie file
    [probe_mov.c] audio codec=raw
    [probe_mov.c] video codec=jpeg
    [tcprobe] summary for p1000001.mov,
    (*) = not default, 0 = not detected import frame size: -g 640x480 [720x576]
    (*)        frame rate: -f 30.000 [25.000] frc=5
    (*)       audio track: -a 0 [0] -e 8000,8,1 [48000,16,2] -n 0x1 [0x2000]
    (*)            length: 1830 frames, frame_time=33 msec, duration=0:01:01.000
  3. Encode Video: Pass 1 of 2

    $ time mencoder p1000001.mov -mc 0 -ovc x264 -x264encopts pass=1:turbo=1:bitrate=589:subq=6:b_pyramid:weight_b:frameref=5:bframes=3:me=3 -nosound -ofps 30000/1001 -of rawvideo -o /dev/null
    MEncoder 1.0pre8-4.1.1 (C) 2000-2006 MPlayer Team
    CPU:         Intel(R) Pentium(R) M processor 1700MHz (Family: 6, Model: 9, Stepping: 5)
    CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
    Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
    
    success: format: 0  data: 0x0 - 0x5106a52
    Quicktime/MOV file format detected.
    VIDEO:  [jpeg]  640x480  24bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
    [V] filefmt:7  fourcc:0x6765706A  size:640x480  fps:30.00  ftime:=0.0333
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
    ==========================================================================
    VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    VDec: using Planar YV12 as output csp (no 3)
    Movie-Aspect is undefined - no prescaling applied.
    SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
    x264 [info]: using SAR=1/1
    x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
    Pos:  33.3s   1000f ( 0%)  8.29fps Trem:   0min   0mb  A-V:0.000 [589:0]
    Skipping frame!
    Pos:  60.9s   1830f ( 0%)  8.97fps Trem:   0min   0mb  A-V:0.000 [541:0]
    Flushing video frames
    
    Video stream:  541.695 kbit/s  (67711 B/s)  size: 4132297 bytes  61.028 secs  1830 frames
    x264 [info]: slice I:9     Avg QP:27.00  size: 17738
    x264 [info]: slice P:873   Avg QP:30.55  size:  3453
    x264 [info]: slice B:947   Avg QP:31.29  size:  1011
    x264 [info]: mb I  I16..4: 53.4%  0.0% 46.6%
    x264 [info]: mb P  I16..4: 15.6%  0.0%  2.5%  P16..4: 40.8%  7.2%  1.0%  0.0%  0.0%    skip:33.0%
    x264 [info]: mb B  I16..4:  0.3%  0.0%  0.2%  B16..8: 17.6%  0.0%  0.0%  direct: 6.8%  skip:75.1%
    x264 [info]: final ratefactor: 26.98
    x264 [info]: ref P  68.8% 19.7% 11.6%
    x264 [info]: ref B  68.4% 21.7%  9.9%
    x264 [info]: kb/s:541.6
    
    real    3m24.324s
    user    2m50.146s
    sys     0m0.601s
    
  4. Encode Video: Pass 2 of 2

    $ time mencoder p1000001.mov -mc 0 -ovc x264 -x264encopts pass=2:bitrate=589:subq=6:b_pyramid:weight_b:frameref=5:bframes=3:me=3 -nosound -ofps 30000/1001 -of rawvideo -o video.264
    MEncoder 1.0pre8-4.1.1 (C) 2000-2006 MPlayer Team
    CPU:         Intel(R) Pentium(R) M processor 1700MHz (Family: 6, Model: 9, Stepping: 5)
    CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
    Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
    
    success: format: 0  data: 0x0 - 0x5106a52
    Quicktime/MOV file format detected.
    VIDEO:  [jpeg]  640x480  24bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
    [V] filefmt:7  fourcc:0x6765706A  size:640x480  fps:30.00  ftime:=0.0333
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
    ==========================================================================
    VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    VDec: using Planar YV12 as output csp (no 3)
    Movie-Aspect is undefined - no prescaling applied.
    SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
    x264 [info]: using SAR=1/1
    x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
    Pos:  33.3s   1000f ( 0%)  4.49fps Trem:   0min   0mb  A-V:0.000 [693:0]
    Skipping frame!
    Pos:  60.9s   1830f ( 0%)  5.26fps Trem:   0min   0mb  A-V:0.000 [587:0]
    Flushing video frames
    
    Video stream:  586.597 kbit/s  (73324 B/s)  size: 4474826 bytes  61.028 secs  1830 frames
    x264 [info]: slice I:9     Avg QP:26.78  size: 16429
    x264 [info]: slice P:873   Avg QP:29.46  size:  3828
    x264 [info]: slice B:947   Avg QP:30.47  size:  1040
    x264 [info]: mb I  I16..4: 56.8%  0.0% 43.2%
    x264 [info]: mb P  I16..4: 14.9%  0.0%  3.1%  P16..4: 44.0%  6.7%  1.0%  0.0%  0.0%    skip:30.3%
    x264 [info]: mb B  I16..4:  0.3%  0.0%  0.1%  B16..8: 17.7%  0.4%  0.7%  direct: 5.4%  skip:75.3%
    x264 [info]: ref P  67.4% 16.5%  8.7%  3.9%  3.4%
    x264 [info]: ref B  71.2% 15.9%  6.4%  3.6%  2.9%
    x264 [info]: kb/s:586.5
    
    real    5m48.617s
    user    4m50.656s
    sys     0m1.194s
    
    $ MP4Box -fps 29.97 -add video.264 video.mp4
    Adjusting AVC SizeLength to 16 bits
    AVC-H264 import - frame size 640 x 480 at 29.9700 FPS
    Import results: 1829 samples - Slices: 9 I 873 P 947 B - 1 SEI - 9 IDR
            Stream uses B-slice references - max frame delay 2
    Saving to video.mp4: 0.500 secs Interleaving
    
    Encode .wav into .ogg $ oggenc -q4 audio.wav
    Opening with wav module: WAV file reader
    Encoding "audio.wav" to 
             "audio.ogg" 
    at quality 4.00
            [ 99.0%] [ 0m00s remaining] - 
    
    Done encoding file "audio.ogg"
    
            File length:  1m 01.0s
            Elapsed time: 0m 00.6s
            Rate:         104.6765
            Average bitrate: 26.7 kb/s
    
    Audio to .wav $ mplayer p1000001.mov -vc dummy -vo null -af volnorm -ao pcm:file=audio.wav
    MPlayer 1.0pre8-4.1.1 (C) 2000-2006 MPlayer Team
    CPU:         Intel(R) Pentium(R) M processor 1700MHz (Family: 6, Model: 9, Stepping: 5)
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
    Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
    
    
    
    Playing p1000001.mov.
    Quicktime/MOV file format detected.
    VIDEO:  [jpeg]  640x480  24bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
    ==========================================================================
    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    AUDIO: 8000 Hz, 1 ch, u8, 64.0 kbit/100.00% (ratio: 8000->8000)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    ==========================================================================
    ==========================================================================
    Forced video codec: dummy
    Cannot find codec matching selected -vo and video format 0x6765706A.
    Read DOCS/HTML/en/codecs.html!
    ==========================================================================
    [AO PCM] File: audio.wav (WAVE)
    PCM: Samplerate: 8000Hz Channels: Mono Format s16le
    [AO PCM] Info: Faster dumping is achieved with -vc null -vo null -ao pcm:fast
    [AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).
    AO: [pcm] 8000Hz 1ch s16le (2 bytes per sample)
    Video: no video
    Starting playback...
    A:  61.0 (01:01.0) of 61.0 (01:01.0)  0.0% 
    
    Exiting... (End of file)
    
    $ mkvmerge -o p100001.avi video.mp4 audio.ogg
    mkvmerge v1.7.0 ('What Do You Take Me For') built on Nov  7 2006 12:14:56
    'video.mp4': Using the Quicktime/MP4 demultiplexer.
    'audio.ogg': Using the OGG/OGM demultiplexer.
    Track 1 of 'video.mp4': Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 640/480.
    'video.mp4' track 1: Using the MPEG-4 part 10 (AVC) video output module.
    'audio.ogg' track 0: Using the Vorbis output module.
    The file 'final.avi' has been opened for writing.
    progress: 100%
    The cue entries (the index) are being written...
    Muxing took 0 seconds.
    
    $ mkvinfo final.avi
    + EBML head
    |+ Doc type: matroska
    |+ Doc type version: 1
    |+ Doc type read version: 1
    + Segment, size 4708649
    |+ Seek head (subentries will be skipped)
    |+ EbmlVoid (size: 4029)
    |+ Segment information
    | + Timecode scale: 1000000
    | + Muxing application: libebml v0.7.7 + libmatroska v0.8.0
    | + Writing application: mkvmerge v1.7.0 ('What Do You Take Me For') built on Nov  7 2006 12:14:56
    | + Duration: 61.040s (00:01:01.040000000)
    | + Date: Tue Nov  7 18:14:02 2006 UTC
    | + Segment UID: 0x2d 0x72 0x49 0xbf 0x9e 0x40 0x74 0xd0 0xfd 0x4e 0x69 0x99 0x43 0x95 0xa7 0x23
    |+ Segment tracks
    | + A track
    |  + Track number: 1
    |  + Track UID: 4092985233
    |  + Track type: video
    |  + Enabled: 1
    |  + Default flag: 1
    |  + Forced flag: 0
    |  + Lacing flag: 0
    |  + MinCache: 1
    |  + Timecode scale: 1.000000
    |  + Max BlockAddition ID: 0
    |  + Codec ID: V_MPEG4/ISO/AVC
    |  + Codec decode all: 1
    |  + CodecPrivate, length 38
    |  + Default duration: 33.385ms (29.954 fps for a video track)
    |  + Language: und
    |  + Video track
    |   + Pixel width: 640
    |   + Pixel height: 480
    |   + Interlaced: 0
    |   + Display width: 640
    |   + Display height: 480
    | + A track
    |  + Track number: 2
    |  + Track UID: 387038320
    |  + Track type: audio
    |  + Enabled: 1
    |  + Default flag: 1
    |  + Forced flag: 0
    |  + Lacing flag: 1
    |  + MinCache: 0
    |  + Timecode scale: 1.000000
    |  + Max BlockAddition ID: 0
    |  + Codec ID: A_VORBIS
    |  + Codec decode all: 1
    |  + CodecPrivate, length 2581
    |  + Language: und
    |  + Audio track
    |   + Sampling frequency: 8000.000000
    |   + Channels: 1
    |+ EbmlVoid (size: 1024)
    |+ Cluster

No comments: