Unable to parse option value "-1" as pixel format when transcoding mp4 to mp4 using ffmpeg

1

I was trying to debug an issue where my mp4 file fail to upload to youtube (with "Upload failed: Can't process file" error). The video plays normally in vlc player and is able to be loaded in Vegas Pro (in fact render it again will fix the upload issue). Checking metadata using MediaInfo does not show anything abnormal compare to other mp4 files from the same source (and worked well when uploading to youtube). After some digging with various tools, I found one issue when I follow the instruction in superuser to transcode the original mp4 file using ffmpeg. Since this is the only issue I can find with the original mp4 file, I think it might be the cause of uploading failure. Now I want to fix it.

Command I used is ffmpeg -i scripts/1.mp4 -pix_fmt yuv420p -crf 18 scripts/good.mp4

The output is

ffmpeg -i scripts/1.mp4 -pix_fmt yuv420p -crf 18 scripts/good.mp4
ffmpeg version N-83577-g7e538c9 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --prefix=/home/________/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/tianyig/ffmpeg_build/include --extra-ldflags=-L/home/tianyig/ffmpeg_build/lib --bindir=/home/tianyig/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x25074a0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 540x960, 950 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'scripts/1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
    copyright       : @Baidu.com
  Duration: 00:12:15.90, start: 0.089000, bitrate: 1027 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 540x960, 950 kb/s, 22.58 fps, 25 tbr, 16k tbn, 32k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 77 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[buffer @ 0x250e200] Unable to parse option value "-1" as pixel format
    Last message repeated 1 times
[buffer @ 0x250e200] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x262a4e0] Error applying options to the filter.
Error opening filters!

It is complaining about pix_fmt with value -1, but clearly I already have a -pix_fmt yuv420p as part of the command which does not seems to be respected.

Any idea how to fix it?

punpun_G

Posted 2017-02-22T00:43:54.410

Reputation: 21

1It's not complaining about the output pixel format. It can't find the input pixel format. Add -probesize 100M -analyzeduration 100M before -i scripts/1.mp4 – Gyan – 2017-02-22T05:01:02.270

Thanks for your suggestion. It does help to find the input pixel format and thus the transcode succeed. It did uploaded to youtube successfully as well. In fact I did tried setting analyzeduration and probesize before but I misread the unit as milliseconds so setting it way to low. – punpun_G – 2017-02-22T18:55:49.623

No answers