0

I have an input video file input.avi as produced by a digital camera

$ avprobe input.avi
avprobe version 11.7-6:11.7-1~deb8u1, Copyright (c) 2007-2016 the Libav developers
  built on Jun 12 2016 21:51:35 with gcc 4.9.2 (Debian 4.9.2-10)
Input #0, avi, from 'input.avi':
  Metadata:
    creation_time   : 2016-08-04 19:42:38
    encoder         : CanonMVI06
  Duration: 00:00:21.60, start: 0.000000, bitrate: 17170 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 20 fps, 20 tbn
    Stream #0.1: Audio: pcm_u8, 11024 Hz, 1 channels, u8, 88 kb/s
# avprobe output

and an up-to date version of ffmpeg

$ ffmpeg
ffmpeg version N-81194-g77b0f3f Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/home/witiko/tmp/ffmpeg_build --bindir=/home/witiko/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. 28.100 / 55. 28.100
  libavcodec     57. 51.100 / 57. 51.100
  libavformat    57. 44.100 / 57. 44.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 49.100 /  6. 49.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

When I transcode the input video to H.265 using the avi envelope format as follows

ffmpeg -i input.avi -c:v libx265 c:a libfdk_aac output.avi

I receive a file that I am unable to play (I tried mpv and vlc) and avprobe reports that a codec of rawvideo is being used.

$ avprobe output.avi
avprobe version 11.7-6:11.7-1~deb8u1, Copyright (c) 2007-2016 the Libav developers
  built on Jun 12 2016 21:51:35 with gcc 4.9.2 (Debian 4.9.2-10)
Input #0, avi, from 'output.avi':
  Metadata:
    encoder         : Lavf57.44.100
  Duration: 00:00:05.10, start: 0.000000, bitrate: 364 kb/s
    Stream #0.0: Video: rawvideo, bgr24, 640x480, 20 fps, 20 tbn
    Stream #0.1: Audio: aac, 11025 Hz, mono, fltp, 66 kb/s
# avprobe output

When I transcode the input video to H.265 using the mp4 envelope format as follows

ffmpeg -i input.avi -c:v libx265 c:a libfdk_aac output.mp4

I receive a file that can be played and avprobe reports the correct codec.

$ avprobe output.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.44.100
  Duration: 00:00:22.23, start: 0.185760, bitrate: 449 kb/s
    Stream #0.0(und): Video: hevc, 640x480, 383 kb/s, 20 fps, 10240 tbn (default)
    Stream #0.1(und): Audio: aac, 11025 Hz, mono, fltp, 66 kb/s (default)

This leads me to the conclusion that the avi envelope format is unable to carry the H.265 payload. I have a couple of the resulting avi files that I am unable to play now and I didn't keep the originals. Is there any way to salvage the video out of these?

1 Answer 1

1

AVI is a very old container and HEVC is a new codec, and FFMpeg coders haven't created a tag to write when muxing HEVC into AVI. That's why the video is reported as rawvideo.

Run

ffmpeg -i output.avi -c copy -vtag hev1 -strict -2 new.avi

The file can be played with ffplay or Potplayer now.

You can also transfer it to an MP4, if you like:

ffmpeg -i new.avi -c copy new.mp4

You can also directly transfer from the original AVI:

ffmpeg -c:v hevc -i output.avi -c copy new.mp4
1
  • Great, this is the answer I was hoping for. Thank you.
    – Witiko
    Commented Aug 5, 2016 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .