V. Panchenko
V. Panchenko

Reputation: 814

ffmpeg converting .mkv to .264

I want to convert .mkv to .264. I try to do it using ffmpeg:

ffmpeg -i input.mkv -vcodec copy -acodec copy output.264

It works without errors, but when I try to play output.264 using ffplay:

ffplay -f h264 -i output.264

ffplay response is:

ffplay version N-75924-gd25c033 Copyright (c) 2003-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      55.  3.100 / 55.  3.100
  libavcodec     57.  5.100 / 57.  5.100
  libavformat    57.  3.100 / 57.  3.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 11.100 /  6. 11.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 03972220] sps_id 24 out of rangeq=    0KB sq=    0B f=0/0
[h264 @ 03972220] missing picture in access unit with size 12836207
[h264 @ 03972220] data partitioning is not implemented. Update your FFmpeg versi
on to the newest one from Git. If the problem still occurs, it means that your f
ile has a feature which has not been implemented.
[h264 @ 03972220] If you want to help, upload a sample of this file to ftp://upl
oad.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-deve
[email protected])
[h264 @ 03972220] data partitioning is not implemented. Update your FFmpeg versi
on to the newest one from Git. If the problem still occurs, it means that your f
ile has a feature which has not been implemented.
[h264 @ 03972220] If you want to help, upload a sample of this file to ftp://upl
oad.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-deve
[email protected])
[h264 @ 03972220] sps_id 24 out of range
[h264 @ 03972220] data partitioning is not implemented. Update your FFmpeg versi
on to the newest one from Git. If the problem still occurs, it means that your f
ile has a feature which has not been implemented.
[h264 @ 03972220] If you want to help, upload a sample of this file to ftp://upl
oad.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-deve
[email protected])
[h264 @ 03972220] no frame!
[h264 @ 039696e0] Stream #0: not enough frames to estimate rate; consider increa
sing probesize
[h264 @ 039696e0] decoding for stream 0 failed
[h264 @ 039696e0] Could not find codec parameters for stream 0 (Video: h264, non
e): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Contagion.264: could not find codec parameters

How I can fix it and convert .mkv to .264 correctly?

Upvotes: 0

Views: 2294

Answers (1)

aergistal
aergistal

Reputation: 31209

You can't put an audio track into a raw H.264 file and you need to use the h264_mp4toannexb bitstream filter to convert the stream to Annex B format:

ffmpeg -i input.mkv -c:v copy -an -bsf:v h264_mp4toannexb out.264

The bitstream filter works without re-encoding.

Upvotes: 2

Related Questions