Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

heic - convert a heif file to png/jpg using ffmpeg

The use case is very straight forward. Imagemagick is able to do the conversion but I want to do it with ffmpeg. Here is the all commands I have tried and all of them gives moov atom not found error.

ffmpeg -i /Users/ajitesh/Downloads/sample1.heif -c:v png -pix_fmt rgb48 /Users/ajitesh/Downloads/sample.png

Output

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f85aa813200] moov atom not found
/Users/ajitesh/Downloads/sample1.heif: Invalid data found when processing input

it seems like moov atom is actually not present by trying to extract the location of moov atom using the following command

ffmpeg -v trace -i /Users/ajitesh/Downloads/sample1.heif 2>&1 | grep -e type:'mdat' -e type:'moov'

Output

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f824c00f000] type:'mdat' parent:'root' sz: 2503083 420 2503495
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f824c00f000] type:'mdat' parent:'root' sz: 2503083 420 2503495

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

FFmpeg does not currently support HEIF decoding (as of 2021-01-11).

Check the bug report #6521: HEIF support as FFmpeg development is active and the situation may change in the future.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...