Question

How to record YUV video and encode it to mp4 using h264 coded for mac application. Plz suggest me any link on it.

Was it helpful?

Solution

FFMpeg can encode YUV to mp4(H.264) via libx264 encoder. But you have to specify exact YUV pixel format of your source video. There are several YUV formats.

This command converts rawvideo with pixel format of yuv420p to a MPEG-4 or x264 format.

# Converts the raw yuv420p data to a MPEG-4 video
ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 1280x720 -framerate 25 -i 'in' -f mp4 'out'

Below list shows YUV pixel formats can be decoded by ffmpeg.

$ ffmpeg -pix_fmts 2>&1 | grep yuv
yuv420p    
yuv422p    
yuv444p    
yuv410p    
yuv411p    
yuvj420p   
yuvj422p   
yuvj444p   
yuv440p    
yuvj440p   
yuva420p   
yuv420p16le
yuv420p16be
yuv422p16le
yuv422p16be
yuv444p16le
yuv444p16be
yuv420p9be 
yuv420p9le 
yuv420p10be
yuv420p10le
yuv422p10be
yuv422p10le
yuv444p9be 
yuv444p9le 
yuv444p10be
yuv444p10le

OTHER TIPS

This is the easiest way to convert video formats using MacOSX command line (any version). First download this compressed file and unpack it to your Movies Folder:

https://drive.google.com/file/d/0B3NlLwMD4yd9QU0yVGJyU1NiUDA/view?usp=sharing

You will then have a MMedia_Converter directory with two apps: MMedia_Convert and Android_Converter. Those are my own developed MacOSX open source applications, bassed on FFMpeg Group and HandBrake Group France previous work. Both are fully compliant Mac compilled applications and you´ll have have to do nothing but extract them to your Movies Folder.

You also have there, 3 folders: clip_in, clip_out and scripts.

You must put the videos you want to be converted in the clip_in folder.

The converted output videos, will be generated automatically in the clip_out folder.

In addition you have 2 bash scripts, that you must move to your Mac OSX Desktop.

Once these bash are on desktop, edit them with TextEdit, and change my user name by your Mac name.

In my case, I use one script to generate thumbnails and the other to generate thumbnails too, and to automatically convert videos from any formar to wathever I choose.

"Whatever" means, that if you want to convert mpeg to mkv, you will have to declare it in line: DEST_EXT=mkv (or wathever known video format you want).

Hope this will help you all.

Best Regards, Tomás Hernández

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top