1

I recently got some CCTV video released to me via a FOIA/PA request. I'd like to put up the full version on YouTube, as well as version edited w/ Final Cut Pro. However, Handbrake, Quicktime, Final Cut Pro, & YouTube are all unable to open the original .avi file. :-(

ffmpeg -i says for avi input #0 (there is no audio part):

  Duration: 00:48:48.73, start: 0.000000, bitrate: 2497 kb/s
    Stream #0:0: Video: h264 (Main) (V264 / 0x34363256), yuv420p, 1280x960, 2495 kb/s, 9.99 fps, 9.99 tbr, 9.99 tbn, 19.98 tbc

Handbrake's log showed this before giving up with "no valid source found" (note the tbr discrepancy vs ffmpeg -i):

  Duration: 00:48:48.72, start: 0.000000, bitrate: 2497 kb/s
    Stream #0.0: Video: V264 / 0x34363256, 1280x960, 10 fps, 29.97 tbr, 9.99 tbn
[13:54:47] scan: decoding previews for title 1
[13:55:28] scan: could not get a decoded picture
[13:55:38] scan: could not get a decoded picture
[13:55:43] scan: could not get a decoded picture
[13:55:49] scan: could not get a decoded picture
[13:55:54] scan: could not get a decoded picture
[13:55:58] scan: could not get a decoded picture
[13:56:03] scan: could not get a decoded picture
[13:56:06] scan: could not get a decoded picture
[13:56:07] Warning: Could not read data for preview 9, skipped
[13:56:07] Warning: Could not read data for preview 10, skipped
[13:56:07] libhb: scan thread found 0 valid title(s)
[13:56:07] macgui: ScanDone state received from fHandle

VLC is able to play it just fine, but I've not managed to get VLC to transcode it into something usable; an attempt at transcoding to m4v and importing that to FCP resulted in a weirdly stuttering and moonwalky video when FCP tried to convert it to a normal FPS. (Edit: not FCP's fault; the transcode itself was screwy. Have also now tried VLC's transcode to mp4 h264 w/ fps set @ 30 also [in addition to not setting fps, and its transcode wizard]; the fps@30 attempt didn't even output something playable. ><)

How can I convert this into something that's of normal size / fps / codec so that I can edit it in FCP and upload it to YouTube specs?

My guess is that ffmpeg should be able to do the job, but I'm not sure how to go about it.

ETA: Now attempting this: ffmpeg -i input.avi -r "29.97" -an -sn -c:v libx264 -qp 0 -preset ultrafast -pix_fmt yuv420p -f mp4 -benchmark output.mp4 - not trying to compress at this stage, just to get it to something workable in FCP & YT.

ETA2: Output of above playable in VLC, not in QT or FCP (but haven't let FCP transcode it for optimized/proxy media yet). In VLC, it does have 29.97 fps, doesn't stutter. About 11x the size of the original (~11.5GB vs 914MB) o.o.

Trying again with -crf 18 -preset slow instead of qp 0 -preset ultrafast to see if I can get a more manageable size w/out noticeable quality loss. ffmpeg docs do warn that many things aren't compatible w/ lossless (but say that YouTube is).

ETA3: Looks like that last one worked. Can be viewed in QuickTime & FCP. Uploading partial edit to YT now. Yay!

  • Tried Compressor, independently of FCP ? – Tetsujin Oct 22 '14 at 20:42
  • @Tetsujin Yup, that was actually my first attempt. Compressor wasn't able to preview the file, and output a totally white video of wrong length. – Sai Oct 22 '14 at 20:46
  • i don't have the knowledge to answer with any authority, but my hunch is that the source vid isn't stating its actual stats correctly, so you're into 'hacky' territory to replace/override those headers. [outside my area of expertise, sorry] – Tetsujin Oct 22 '14 at 20:48
  • @Tetsujin That's quite possible. FWIW, other FOIA'd documents showed that agency people were having a lot of trouble even reading the source video. They mention that the source video was Verint video codec. I don't know whether the video I provided is the same as the one they reference, or some sort of transcode thereof. – Sai Oct 22 '14 at 20:55
1

Here's what ultimately worked for me:

ffmpeg -i input.avi -r "29.97" -an -sn -c:v libx264 -crf 18 -preset slow -pix_fmt yuv420p -f mp4 -benchmark output.mp4

Details:

ffmpeg version 2.4.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 28 2014 17:37:55 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-vda --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, avi, from 'input.avi':
  Duration: 00:48:48.73, start: 0.000000, bitrate: 2497 kb/s
    Stream #0:0: Video: h264 (Main) (V264 / 0x34363256), yuv420p, 1280x960, 2495 kb/s, 9.99 fps, 9.99 tbr, 9.99 tbn, 19.98 tbc
[libx264 @ 0x7ff583005800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff583005800] profile High, level 4.0
[libx264 @ 0x7ff583005800] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=6 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=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x960, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.1.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=87772 fps= 11 q=-1.0 Lsize= 1800751kB time=00:48:48.59 bitrate=5037.1kbits/s dup=58545 drop=0
video:1799693kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.058756%
bench: utime=18905.661s
bench: maxrss=381239296kB
[libx264 @ 0x7ff583005800] frame I:352   Avg QP:13.93  size:362691
[libx264 @ 0x7ff583005800] frame P:28322 Avg QP:16.87  size: 48853
[libx264 @ 0x7ff583005800] frame B:59098 Avg QP:20.71  size:  5611
[libx264 @ 0x7ff583005800] consecutive B-frames:  2.3% 23.2%  1.5% 73.0%
[libx264 @ 0x7ff583005800] mb I  I16..4: 14.7% 27.1% 58.2%
[libx264 @ 0x7ff583005800] mb P  I16..4:  0.8%  1.1%  1.1%  P16..4: 43.3%  7.4%  6.6%  0.0%  0.0%    skip:39.7%
[libx264 @ 0x7ff583005800] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 18.8%  2.0%  0.8%  direct: 1.6%  skip:76.5%  L0:49.7% L1:46.8% BI: 3.4%
[libx264 @ 0x7ff583005800] 8x8 transform intra:35.1% inter:14.5%
[libx264 @ 0x7ff583005800] direct mvs  spatial:100.0% temporal:0.0%
[libx264 @ 0x7ff583005800] coded y,uvDC,uvAC intra: 87.7% 87.0% 66.9% inter: 15.9% 13.2% 7.3%
[libx264 @ 0x7ff583005800] i16 v,h,dc,p: 10%  9% 19% 63%
[libx264 @ 0x7ff583005800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 17% 16%  6%  7%  7% 10%  8% 13%
[libx264 @ 0x7ff583005800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12%  9%  8%  9% 11% 10% 12% 11% 18%
[libx264 @ 0x7ff583005800] i8c dc,h,v,p: 52% 17% 20% 10%
[libx264 @ 0x7ff583005800] Weighted P-Frames: Y:0.1% UV:0.0%
[libx264 @ 0x7ff583005800] ref P L0: 82.7%  3.9%  6.2%  5.1%  1.7%  0.4%  0.0%
[libx264 @ 0x7ff583005800] ref B L0: 93.4%  4.4%  1.9%  0.3%
[libx264 @ 0x7ff583005800] ref B L1: 97.6%  2.4%
[libx264 @ 0x7ff583005800] kb/s:5034.07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.