3d0c/gmf

Invalid Thumbnails

Closed this issue · 2 comments

I tried the examples video-to-jpeg.go and video-to-jpeg-p.go, and both are producing invalid JPGs. I tried several mp4 and avi files, as well as the tests-sample.mp4 that's included with the examples. I tried viewing the created JPGs with several image viewers which all failed, and I took a look at the binary code in the files and they do not appear to be jpgs. I'm not having any problems creating thumbnails using the ffmpeg command line app. I didn't have any problems building gmf.

I wish this was a problem I could fix myself, but ffmpeg internals are a little over my head. Here's my info.

$ go version
go version go1.3.1 linux/amd64

$ ffmpeg -version
ffmpeg version N-65769-ga6af4bf Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 20 2014 00:11:34 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/usr/local/ffmpeg --enable-shared
libavutil 54. 5.100 / 54. 5.100
libavcodec 56. 0.101 / 56. 0.101
libavformat 56. 1.100 / 56. 1.100
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 0.100 / 5. 0.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100

$ echo $PKG_CONFIG_PATH
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/ffmpeg/lib/pkgconfig

$ pkg-config --libs libavformat
-L/usr/local/ffmpeg/lib -lavformat

3d0c commented

I can't reproduce your problem. I'll try to dig it later.
Try this simplified version examples/video-to-mjpeg.go, it uses mjpeg codec, which is presented in any ffmpeg build by default and should work.

The video-to-mjpeg.go script does work. I don't have any problems opening the thumbnails it creates in any image viewer.

I found I can view the images created by video-to-jpeg.go and video-to-jpeg-p.go if I change the output file name to have a .jp2 extension, although ImageMagick can view them regardless of extension. I guess some image viewers are smarter than others.