1
I want to convert videos to a format that my camera reads with ffmpeg.
I have some sample videos from the camera and analyzed them with
mplayer -frames 0 -identify DSCN0001.mov
and with
ffprobe DSCN0001.mov
Then I tried everything I could find in the documentation to create a video of the same type. My command was
ffmpeg -i movie.flv -vcodec mjpeg -b:v 2128296 -pix_fmt yuvj422p -r 15 -acodec pcm_u8 -ac 1 -ar 7875 -vf scale=320:240 DSCN0002.mov
But when I try to play the video with the camera, the camera tells me The file contains no image data (translated).
This is the diff from the ffprobe analysis
1c1
< Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSCN0001.mov':
---
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSCN0002.mov':
3,7c3,8
< creation_time : 2011-10-08 17:17:30
< comment : NIKON DIGITAL CAMERA
< comment-eng : NIKON DIGITAL CAMERA
< Duration: 00:00:03.40, start: 0.000000, bitrate: 1977 kb/s
< Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 320x240, 1879 kb/s, 15 fps, 15 tbr, 600 tbn, 600 tbc
---
> major_brand : qt
> minor_version : 512
> compatible_brands: qt
> encoder : Lavf53.32.100
> Duration: 00:05:09.06, start: 0.000000, bitrate: 2196 kb/s
> Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 320x240 [SAR 25:24 DAR 25:18], 2131 kb/s, 15 fps, 15 tbr, 15 tbn, 15 tbc
9d9
< creation_time : 2011-10-08 17:17:30
10a11
> DataHandler
13,14c14,15
< creation_time : 2011-10-08 17:17:30
< handler_name :
---
> handler_name :
> DataHandler
and from the mplayer analysis (I’ve cut out the lines that were equal, to make this paste smaller).
1,16c1,19
< Playing DSCN0001.mov.
< VIDEO: [jpeg] 320x240 24bpp 15.000 fps 2053.4 kbps (250.7 kbyte/s)
< creation_time: 2011-10-08 17:14:54
< ID_CLIP_INFO_NAME0=creation_time
< ID_CLIP_INFO_VALUE0=2011-10-08 17:14:54
< comment: NIKON DIGITAL CAMERA
< ID_CLIP_INFO_NAME1=comment
< ID_CLIP_INFO_VALUE1=NIKON DIGITAL CAMERA
< comment-eng: NIKON DIGITAL CAMERA
< ID_CLIP_INFO_NAME2=comment-eng
< ID_CLIP_INFO_VALUE2=NIKON DIGITAL CAMERA
< ID_CLIP_INFO_N=3
< ID_FILENAME=DSCN0001.mov
< ID_VIDEO_BITRATE=2053400
< ID_VIDEO_ASPECT=0.0000
< ID_LENGTH=91.00
---
> Playing DSCN0002.mov.
> VIDEO: [jpeg] 320x240 24bpp 15.000 fps 1953.5 kbps (238.5 kbyte/s)
> major_brand: qt
> ID_CLIP_INFO_NAME0=major_brand
> ID_CLIP_INFO_VALUE0=qt
> minor_version: 512
> ID_CLIP_INFO_NAME1=minor_version
> ID_CLIP_INFO_VALUE1=512
> compatible_brands: qt
> ID_CLIP_INFO_NAME2=compatible_brands
> ID_CLIP_INFO_VALUE2=qt
> encoder: Lavf53.32.100
> ID_CLIP_INFO_NAME3=encoder
> ID_CLIP_INFO_VALUE3=Lavf53.32.100
> ID_CLIP_INFO_N=4
> ID_FILENAME=DSCN0002.mov
> ID_VIDEO_BITRATE=1953464
> ID_VIDEO_ASPECT=1.3889
> ID_LENGTH=309.07
What I immediately noticed was
- the
ID_VIDEO_ASPECT
of the mplayer analysis. The original video has0.0000
and the fake one has1.3889
. - the original has
600 tbn, 600 tbc
and the fake has15 tbn, 15 tbc
at ffmpeg analysis. - the fake has
[SAR 25:24 DAR 25:18]
where the original has nothing. This is probably the aspect ratio of the video. - And of course the different comments and the creation time and so on. I hope they are not important. I changed the NIKON DIGITAL CAMERA to something else in the original video with a hex editor and the video still played.
Any ideas how to improve my fake video?
Update
Another difference. I get the following with the file command. :-(
$ file DSCN0001.mov DSCN0002.mov
DSCN0001.mov: data
DSCN0002.mov: ISO Media, Apple QuickTime movie
The first video is the original one. The second is my ffmpeg creation.
Update 2
I’ve tried to just copy the input streams from the original file to a new file with, in my opinion, same container (mov).
ffmpeg -i DSCN0001.mov -c:v copy -c:a copy DSCN0005.mov
And file tells me for this copied video
DSCN0005.mov: ISO Media, Apple QuickTime movie
The new file was a bit smaller. Comparing them with a hex editor I saw, that they have different magic numbers. So I think this is a container problem, not a codec problem. The camera is a Nikon Coolpix. Maybe I should ask ffmpeg developers if this container format is supported. At least it is readable and playable by mplayer and ffmpeg.
My first guess would be the colorspace difference (yuvj422p vs yuvj420p) is causing the issue, but I don't know how to make FFMPEG change that. – heavyd – 2013-02-11T23:58:54.943
I added
-pix_fmt yuvj422p
to conversion command. Now there is nomore difference, but still the same error from the camera. – erik – 2013-02-12T00:20:43.430If you ask on ffmpeg-user mailing list (or #ffmepg IRC) then make sure you are using the most recent ffmpeg build that you can and also include your ffmpeg commands and the complete ffmpeg console outputs and not just a diff.
– llogan – 2013-02-12T19:01:12.013