ffmpeg command to convert from mp4 video to .h264 raw frame with avcc format
I want to convert my mp4 video (BigBuckBunny.mp4) to BigBuckBunny.h264 file. I used the following the command in ffmpeg.
ffmpeg.exe -i c:\BigBuckBunny.mp4 -c:v libx264 c:\Bunni2.h264This command is able to convert the video to raw h264 file. When I opened the file in file viewer the NAL header preceded with 0x00 0x00 0x00 0x01 (4 bytes - start bytes).
But I want the frame to have size (avcc format) in little endian instead of start bytes. I am looking for output options to generate .h264 file in avcc format.
31 Answer
Select m4v output format.
m4v format applies "MPEG-4 Part 2 video format", and applies H.264 with AVCC format (it's undocumented).
In case your original video is already encoded in H.264 codec, use -vcodec copy -f m4v:
ffmpeg -y -i Big_Buck_Bunny_360_10s_1MB.mp4 -vcodec copy -f m4v Bunni2.h264In case you have to re-encode the input, you may encode the input with FLV container and use pipe to second FFmpeg with -vcodec copy -f m4v:
ffmpeg -i Big_Buck_Bunny_360_10s_1MB.mp4 -vcodec libx264 -f flv pipe: | ffmpeg -y -i pipe: -vcodec copy -f m4v Bunni2.h264 1