4

I try to extract the video stream from the bbb-1920x1080-cfg02.mkv

The command as follows.

ffmpeg -i bbb-1920x1080-cfg02.mkv -map 0:0 -c copy bbb.mkv

But the output file can't play with the player(potplayer)

I used the ffmpeg -i bbb.mkv to check the information and there were lots of error messages.

ffmpeg version N-80680-ga887fbb Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-vaapi --disable-vda --disable-vdpau --disable-libxcb  --disable-ffplay --disable-ffserver --disable-ffprobe --disable-indev=jack --disable-outdev=sdl --enable-libx264 --enable-libx265 --enable-gpl --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape --disable-x11grab
libavutil      55. 26.100 / 55. 26.100
libavcodec     57. 46.100 / 57. 46.100
libavformat    57. 40.101 / 57. 40.101
libavdevice    57.  0.101 / 57.  0.101
libavfilter     6. 46.102 /  6. 46.102
libswscale      4.  1.100 /  4.  1.100
libswresample   2.  1.100 /  2.  1.100
libpostproc    54.  0.100 / 54.  0.100
[hevc @ 0x3a64a60] No start code is found.
[hevc @ 0x3a64a60] Error splitting the input into NAL units.
[hevc @ 0x3a64a60] No start code is found.

Even I just make a copy of the source file.

ffmpeg -i bbb-1920x1080-cfg02.mkv -map 0 -c copy bbb.mkv

The output file(bbb.mkv) still can't play with the player(potplayer) It still has "[hevc @ 0x3a64a60] No start code is found" error.

As the document said that it would do notthing but just encapsulate the matroska format.

Is anyone can teach me how to figure out this problem?

Thanks

user1395066
  • 127
  • 1
  • 1
  • 11

2 Answers2

6

You'll have to use a bitstream filter. Seems like FFmpeg does not write the correct codec tag without it.

ffmpeg -i bbb-1920x1080-cfg02.mkv -map 0:0 -c copy -vbsf hevc_mp4toannexb bbb.mkv
Gyan
  • 85,394
  • 9
  • 169
  • 201
0

I tried the ffmpeg solution from Gyan, but it didn't work for me. I also had to specify the format. Here is what I did to get just the H.265 bitstream. Also, I did see that some people suggested setting the output file extension to .bin, but I like h264/h265 as it makes it more clear what kind of bitstream the file contains.

H.265 to Annex B

ffmpeg -i test.mkv -c:v copy -bsf hevc_mp4toannexb -f hevc test.h265

H.264 to Annex B

ffmpeg -i test.mkv -c:v copy -bsf h264_mp4toannexb -f h264 test.h264

NOTE: This also works for .mov files and probably for other formats as well.

arndtc
  • 1
  • 1