VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Member
    Join Date
    Nov 2013
    Location
    Florida
    Search PM
    Setup: I'm trying to batch convert a bunch of video files that I've collected over the years, and although I've tried many of the available conversion applications, every single one of them seems to have something that I don't like about the way it works, so I decided to write my own little tool that acts as ffmpeg front-end. It's very simple - it accepts via drag/drop a bunch of files from Windows Explorer, and then executes ffmpeg with various parameters (based on exactly where I drop them) to convert the file to an MP4.

    Problem: My program works great, with one exception - although the resulting MP4 file plays fine, I don't see a preview thumbnail image for the video when I view it in icon mode in Windows explorer. I do see an icon for MP4 files that have been created by other programs, however, so it isn't a Windows explorer issue per se.

    The basic command I'm executing to create the MP4 is very simple:
    ffmpeg -i <inputfile> -crf 25 <outputfile>

    I'm using a very recent version of ffmpeg (build date is Oct 29 2013). However, I only know enough about ffmpeg to be dangerous, so I'm sure I just need to add another flag or something to get it to output the file correctly so that I see the preview thumbnail. If needed, I can alter my program to execute other applications in order if needed.

    Can anyone suggest a fix? Thanks!
    Quote Quote  
  2. use mediainfo (view=>text) copy & paste the results back here comparing the MP4 files that show a preview vs. the ones that do not
    Quote Quote  
  3. Member
    Join Date
    Nov 2013
    Location
    Florida
    Search PM
    FYI I have found a utility to allow me to add a Windows preview thumbnail (AtomicParsley) but this means that I have to do three steps - encode via ffmpeg, extract a frame via ffmpeg, insert the frame via atomicparsley. I'm still hoping that ffmpeg can do this all by itself in one step, but if not then at least I have a solution.


    Here's the MediaInfo 'Advanced' output for an AVI transcoded to MP4 by MediaCoder, which does show a Windows preview thumbnail... I've also included MediaCoder's log file (via F6 window) at the very bottom - it's apparently going thru a more complicated process of demuxing (via ffmpeg), transcoding (via x264/nero) then remuxing (via mp4box), so I suppose that the preview thumbnail is being set by mp4box. I'll do some more investigating there as well, unless someone provides an easy answer.

    General
    Complete name : G:\_ToArchive\Pictures\2011.07.05 - Swimming Pool\P7050021.mp4
    Format : MPEG-4
    Format profile : Base Media
    Codec ID : isom
    File size : 452 KiB
    Duration : 2s 432ms
    Overall bit rate mode : Variable
    Overall bit rate : 1 522 Kbps
    Encoded date : UTC 2013-11-02 19:49:36
    Tagged date : UTC 2013-11-02 19:49:36


    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L1.2
    Format settings, CABAC : Yes
    Format settings, ReFrames : 2 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 2s 333ms
    Bit rate : 1 565 Kbps
    Maximum bit rate : 1 931 Kbps
    Width : 320 pixels
    Height : 240 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Constant
    Frame rate : 15.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 1.359
    Stream size : 446 KiB (99%)
    Writing library : x264 core 138 r2359+704+48 3f879a0 tMod [8-bit@all X86]
    Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / fade_compensate=0.00 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=2 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / fgo=0 / bframes=1 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=cqp / mbtree=0 / qp=25 / ip_ratio=1.40 / pb_ratio=1.30 / aq=0 / aq2=0 / aq3=0
    Encoded date : UTC 2013-11-02 19:49:36
    Tagged date : UTC 2013-11-02 19:49:36


    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 2s 432ms
    Bit rate mode : Variable
    Bit rate : 13.4 Kbps
    Maximum bit rate : 15.0 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 8 000 Hz
    Compression mode : Lossy
    Stream size : 3.99 KiB (1%)
    Encoded date : UTC 2013-11-02 19:49:36
    Tagged date : UTC 2013-11-02 19:49:36
    And the exact same file encoded directly by ffmpeg, in which no Windows preview thumbnail appears:


    General
    Complete name : G:\_ToArchive\Pictures\2011.07.05 - Swimming Pool\P7050021.mp4
    Format : MPEG-4
    Format profile : Base Media
    Codec ID : isom
    File size : 304 KiB
    Duration : 2s 600ms
    Overall bit rate mode : Variable
    Overall bit rate : 958 Kbps
    Writing application : Lavf55.19.104


    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High 4:2:2@L1.2
    Format settings, CABAC : Yes
    Format settings, ReFrames : 4 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 2s 400ms
    Bit rate : 1 020 Kbps
    Width : 320 pixels
    Height : 240 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Constant
    Frame rate : 15.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:2
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.885
    Stream size : 299 KiB (98%)
    Writing library : x264 core 138 r2358 9e941d1
    Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=15 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=25.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00


    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 2s 600ms
    Duration_LastFrame : -88ms
    Bit rate mode : Variable
    Bit rate : 11.0 Kbps
    Maximum bit rate : 128 Kbps
    Channel(s) : 2 channels
    Original Channel count : 1 channel
    Channel positions : Front: C
    Sampling rate : 8 000 Hz
    Compression mode : Lossy
    Delay relative to video : 133ms
    Stream size : 3.50 KiB (1%)

    MediaCoder's log file when transcoding the above file:


    MediaCoder Version 0.8.26 build 5566 (built on Oct 9 2013, 11:40:33)


    MediaCoder is a freeware. You can freely redistribute it under its redistributio
    n terms and conditions.
    (C)2005-2013 Stanley Huang <stanleyhuangyc@gmail.com>. All Rights Reserved.


    Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (2987Mhz)
    CPU Number: 1 CPU Cores: 2
    CPU Cache: L1 32KB L2 6144KB L3 -1KB
    CPU SIMD: MMX SSE SSE2 SSE3 SSSE3 SSE4 SSE4.1
    North Bridge: 0x80862e20 South Bridge: 0x80863a16
    OpenCL runtime: No
    MEncoder UNKNOWN-4.6.2 (C) 2000-2012 MPlayer Team
    success: format: 0 data: 0x0 - 0xc0878
    libavformat version 54.63.104 (internal)
    AVI file format detected.
    [aviheader] Video stream found, -vid 0
    [aviheader] Audio stream found, -aid 1
    VIDEO: [MJPG] 320x240 24bpp 15.000 fps 2520.6 kbps (307.7 kbyte/s)
    [V] filefmt:3 fourcc:0x47504A4D size:320x240 fps:15.000 ftime:=0.0667
    ================================================== ========================
    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)
    ================================================== ========================
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    Opening video filter: [harddup]
    Opening video filter: [format fmt=i420]
    Opening video filter: [scale]
    Opening video filter: [softskip]
    Opening video filter: [yadif=0]
    ================================================== ========================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    libavcodec version 54.92.100 (internal)
    Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
    ================================================== ========================
    Audio data will be piped out through pipe 6
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    Movie-Aspect is undefined - no prescaling applied.
    [swscaler @ 01c8cce0]BICUBIC scaler, from yuv422p to yuv420p using MMXEXT


    # x264 --no-progress --weightp 2 --b-pyramid strict --scenecut 40 --rc-lookahead
    40 --b-adapt 1 --keyint 250 --min-keyint 25 --non-deterministic --ref 2 --aq-mo
    de 1 --aq-strength 1.0 --subme 6 --ref 2 --me hex --merange 16 --bframes 1 --tre
    llis 1 --weightb --direct auto --psy-rd 1:0 --qp 25 --sar 1:1 --threads 2 --demu
    xer raw --input-res 320x240 --fps 15 --input-csp i420 -o "C:\Users\mbray\AppData
    \Local\Temp\mctemp3564b2ae12ff10dd.264" -


    New_Face failed. Maybe the font path is wrong.
    Please supply the text font file (~/.mplayer/subfont.ttf).
    subtitle font: load_sub_face failed.
    New_Face failed. Maybe the font path is wrong.
    Please supply the text font file (~/.mplayer/subfont.ttf).
    subtitle font: load_sub_face failed.


    # neroAacEnc.exe -lc -q 0.25 -ignorelength -if - -of "C:\Users\mbray\AppData\Loc
    al\Temp\mctemp3564b2ae12ff10dd.m4a"


    raw [info]: 320x240p 1:1 @ 15/1 fps (cfr)
    raw [info]: color matrix: undef
    x264 [info]: using SAR=1/1
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
    x264 [info]: profile High, level 1.2
    x264 [info]: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1
    fade_compensate=0.00 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trelli
    s=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 loo
    kahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 c
    onstrained_intra=0 fgo=0 bframes=1 b_pyramid=0 b_adapt=1 b_bias=0 direct=3 weigh
    tb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 r
    c=cqp mbtree=0 qp=25 ip_ratio=1.40 pb_ratio=1.30 aq=0 aq2=0 aq3=0
    x264 [info]: started at Sat Nov 02 15:49:33 2013
    ************************************************** ***********
    * *
    * Nero AAC Encoder *
    * Copyright 2009 Nero AG *
    * All Rights Reserved Worldwide *
    * *
    * Package build date: Feb 18 2010 *
    * Package version: 1.5.4.0 *
    * *
    * See -help for a complete list of available parameters. *
    * *
    ************************************************** ***********




    Adaptive cache: 98 MB (900 frames)
    Processed 1 seconds...
    Flushing video frames.


    Video stream: 13824.000 kbit/s (1728000 B/s) size: 4032000 bytes 2.333 secs
    37 frames


    Audio stream: 256.000 kbit/s (32000 B/s) size: 76800 bytes 2.400 secs


    x264 [info]: frame I:1 Avg QP:22.00 size: 24537
    x264 [info]: frame P:17 Avg QP:25.00 size: 15422
    x264 [info]: frame B:17 Avg QP:27.00 size: 9991
    x264 [info]: consecutive B-frames: 2.9% 97.1%
    x264 [info]: mb I I16..4: 1.3% 46.7% 52.0%
    x264 [info]: mb P I16..4: 0.2% 27.7% 13.6% P16..4: 18.0% 24.6% 15.5% 0.0% 0
    .0% skip: 0.4%
    x264 [info]: mb B I16..4: 1.5% 7.0% 11.8% B16..8: 17.1% 25.8% 15.5% direct:
    15.0% skip: 6.3% L0:18.1% L1:20.6% BI:61.3%
    x264 [info]: 8x8 transform intra:55.3% inter:34.7%
    x264 [info]: direct mvs spatial:94.1% temporal:5.9%
    x264 [info]: coded y,uvDC,uvAC intra: 97.2% 93.2% 78.5% inter: 79.4% 52.8% 22.3%


    x264 [info]: i16 v,h,dc,p: 3% 10% 58% 29%
    x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 17% 25% 6% 8% 5% 14% 7% 13%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 18% 16% 9% 9% 7% 16% 8% 12%
    x264 [info]: i8c dc,h,v,p: 50% 27% 11% 12%
    x264 [info]: Weighted P-Frames: Y:17.6% UV:11.8%
    x264 [info]: ref P L0: 52.3% 22.4% 20.7% 4.5%
    x264 [info]: kb/s:1565.32


    encoded 35 frames, 19.71 fps, 1565.32 kb/s, 445.85 KB
    x264 [info]: ended at Sat Nov 02 15:49:35 2013
    x264 [info]: encoding duration 0:00:02


    # "mp4box" -tmp "C:\Users\mbray\AppData\Local\Temp" -inter 500 -keep-all -add "
    C:\Users\mbray\AppData\Local\Temp\mctemp3564b2ae12 ff10dd.264"#video:fps=15ar=1
    :1 -add "C:\Users\mbray\AppData\Local\Temp\mctemp3564b2ae1 2ff10dd.m4a"#audio "G:
    \_ToArchive\Pictures\2011.07.05 - Swimming Pool\P7050021.mp4"


    AVC-H264 import - frame size 320 x 240 at 15.000 FPS
    AVC Import results: 35 samples - Slices: 1 I 17 P 17 B - 1 SEI - 1 IDR
    IsoMedia import - track ID 1 - Audio (SR 8000 - 2 channels)
    Saving to G:\_ToArchive\Pictures\2011.07.05 - Swimming Pool\P7050021.mp4: 0.500
    secs Interleaving
    Quote Quote  
  4. It might be the moov atom

    Check the two videos with mp4box if it's before mdat

    MP4Box -info video.mp4


    If that's the difference, for ffmpeg , I think -movflags faststart will move the moov atom to the beginning (like atomic parsley, qt faststart) . Or some ffmpeg derivative binaries like ffmbc automatically do it for MP4 muxing
    Quote Quote  
  5. If the cause wasn't the moov atom , Another difference is one is 4:2:0, the one that doesn't work is 4:2:2 .

    Many software splitters/decoders aren't necessarily setup to handle AVC 4:2:2 - so whether or not you get a preview might depend on what directshow filters you have installed

    I'm going to guess this source was from a mjpeg camera phone ?

    In ffmpeg, if you want to convert to 4:2:0 use " -pix_fmt yuv420p "
    Quote Quote  
  6. Member
    Join Date
    Nov 2013
    Location
    Florida
    Search PM
    Solved: adding the -pix_fmt yuv420p generates a file where the preview thumbnail is visible!

    FWIW, you were also correct about the moov atom - in MediaCoder's version, it was "moov before mdat", but in my original ffmpeg output, it was not. Adding the -movflags faststart did produce output where mp4box indicated "moov before mdat" but this did not create a file where the preview thumbnail was visible. Still, I'll be including this flag in my command-line.

    Thanks!!!
    Quote Quote  



Similar Threads

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