how to convert a video to a MOV file with h264 yuvj420p and pcm u8

1

I want to convert some videos to be playable on a Canon digital camera.

The videos from the Canon PowerShot camera have the following specifications:

Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p, 1280x720, 22865 kb/s, 29.97 fps
Audio: pcm_u8 (raw  / 0x20776172), 12000 Hz, mono, u8, 96 kb/s

What would the ffmpeg-command line look like to produce such videos? Or where can I read about it? I have to tried to find it with ffmpeg -formats which gives me a big list of formats. From this and some furter reading in the man page I have come to this command:

ffmpeg -i oldmovie.mp4 -acodec pcm_u8 -ar 12000 -ac 1 -vcodec copy -pix_fmt yuvj420p MVI_2655.MOV

but it still does not work. The video spec is different.

The video I get is:

Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x272 [SAR 153:154 DAR 180:77], 326 kb/s

but the correct video should have

Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p, 1280x720, 22865 kb/s

I think the resolution is not the problem, but the High versus Constrained Baseline. And the yuv420p versus the yuvj420p. How do I achieve these specs?

erik

Posted 2015-09-14T13:31:45.767

Reputation: 1 519

1You can't use '-vcodec copy'. You need to reencode the video track too : ffmpeg -i oldmovie.mp4 -acodec pcm_u8 -ar 12000 -ac 1 -vcodec libx264 -pix_fmt yuvj420p -profile:v baseline MVI_2655.MOV – Ely – 2015-09-14T15:00:32.907

@Ely it's worth writing that up as an answer, perhaps with explanations of the various options. I would myself but you beat me to it! :P – bertieb – 2015-09-14T15:57:02.723

Can you provide a short sample file from the camera? – llogan – 2015-09-15T16:23:55.153

Answers

0

With the hint from Ely and bit a further research I have found this command line to produce the exact same format specifications:

ffmpeg -i oldmovie.mp4 -acodec pcm_u8 -ar 12000 -ac 1 -vcodec libx264 -pix_fmt yuvj420p -profile:v baseline -s 1280x720 -r ntsc -colorspace smpte170m -color_primaries bt709 -color_trc bt709 MVI_2655.MOV

where

  • -vcodec libx264 together with -profile:v baseline and -pix_fmt yuvj420p sets the video to Constrained Baseline and the pixel format to yuvj420p
  • -colorspace smpte170m, -color_primaries bt709 and -color_trc bt709 sets the three pixel format subspecifications after yuvj420p(pc,…), which I’ve found here
  • -r ntsc sets a framerate of 29.97 (where ntsc is an alias for the framerate)
  • -s 1280x720 scales the video to the same width and height as the original canon video

Now the only difference is the bitrate, which is 4065 kb/s for my ffmpeg-created video and 21588 kb/s for the canon video.

But nevertheless the video still can’t be played on the Canon camera. :-(

erik

Posted 2015-09-14T13:31:45.767

Reputation: 1 519

There's probably a udta atom in Canon's files that the camera looks for. – Gyan – 2016-03-06T18:42:36.140