1

I'm trying to convert a raw video-only file to some other formats but all I'm getting ffmpeg to produce is a black video. There are no error messages displayed and this is what ffprobe shows when analyzing the file:

ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Input #0, avi, from '1.avi': Metadata: encoder : Lavf54.20.4 Duration: 00:00:57.43, start: 0.000000, bitrate: 83196 kb/s Stream #0:0: Video: rawvideo, pal8, 720x480, 83238 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc

Other input files can be transcoded to a playable outfile file with the same ffmpeg convert command:

ffmpeg -i 1.avi -vcodec h264 output.avi

I know the input video is not corrupted because VLC plays it successfully and can even convert it to other formats, but I want to preserve the original one when trying different configurations using ffmpeg.

Thanks in advance for helping!

4
  • 1
    This does not appear to be a programming question, and is thus off-topic for Stack Overflow. It will probably be a better fit on our sister site Super User.
    – Joe C
    Commented Feb 5, 2017 at 10:28
  • Does ffplay play the file?
    – Gyan
    Commented Feb 5, 2017 at 11:00
  • 1
    You might need to tell ffmpeg the pixel format: ffmpeg -vcodec rawvideo -pix_fmt bgr24 -i 1.avi -vcodec h264 output.avi, but it's hard to answer without having access to the input file. Also note: Joe C is right, move your question to Super User site.
    – Rotem
    Commented Feb 5, 2017 at 21:15
  • Try defining the codec before specifying the input file: ffmpeg -f h264 -i 1.avi -vcodec copy -acodec aac output.avi and it's probably better to use mp4 container.
    – WLGfx
    Commented Feb 8, 2017 at 15:36

1 Answer 1

0

ffmpeg cannot "guess" the video details from the raw video stream. Therefore, the details should be explicitly specified to ffmpeg when input file is a raw video.

As minimum, the video resolution and frame format should be provided. In this particular case the command would be:

ffmpeg -f rawvideo -pix_fmt pal8 -video_size 720x480 -i 1.avi -vcodec h264 output.avi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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