[FFmpeg-user] filter thumbnail does not respect aspect ratio
Thomas Seilund
tps at netmaster.dk
Tue Apr 9 12:58:10 CEST 2013
On 09-04-2013 12:45, Carl Eugen Hoyos wrote:
> Thomas Seilund <tps <at> netmaster.dk> writes:
>
>> 16:9 video:
>>
>> ffmpeg -i p20120122142736.mpg -ss 0 -vf thumbnail
>> -frames:v 1 thumbnail.jpg
> I suspect you want to use -vf thumbnail,scale=iw*sar:ih
> to get an output file with sar=1:1 which will be displayed
> as expected by applications that ignore the JFIF aspect.
>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Hi Carl
Thanks a lot.
That did the trick!
Now I get this and this is what I wanted.
16:9
ffmpeg -i p20120122142736.mpg -ss 0 -vf thumbnail -frames:v 1 -vf
scale=iw*sar:ih thumbnail.jpg
ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 13 2013 20:25:12 with gcc 4.6.3
configuration: --prefix=/usr --libdir=/usr/lib64
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe'
--extra-cflags='-march=native -O2 -pipe' --extra-cxxflags='-O2 -pipe'
--disable-static --enable-gpl --enable-version3 --enable-postproc
--enable-avfilter --disable-stripping --disable-debug --disable-doc
--disable-network --disable-vaapi --disable-vdpau --disable-ffplay
--enable-libmp3lame --enable-libvo-aacenc --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-libfaac --enable-nonfree
--disable-indev=v4l --disable-indev=alsa --disable-indev=oss
--disable-indev=jack --enable-libv4l2 --disable-outdev=alsa
--disable-outdev=oss --disable-outdev=sdl --enable-libfreetype
--enable-libvpx --disable-amd3dnow --disable-amd3dnowext
--disable-altivec --disable-avx --disable-mmx2 --disable-ssse3
--disable-vis --disable-neon --cpu=host --enable-hardcoded-tables
libavutil 51. 35.100 / 51. 35.100
libavcodec 53. 61.100 / 53. 61.100
libavformat 53. 32.100 / 53. 32.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0x7f2943d6b620] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'p20120122142736.mpg':
Duration: 00:01:24.80, start: 1.000000, bitrate: 6577 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
64:45 DAR 16:9], 9000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting
format 'yuvj420p'
[buffer @ 0x7f2943d737a0] w:720 h:576 pixfmt:yuv420p tb:1/1000000
sar:64/45 sws_param:
[scale @ 0x7f2943d7fb00] w:720 h:576 fmt:yuv420p -> w:1024 h:576
fmt:yuvj420p flags:0x4
Output #0, image2, to 'thumbnail.jpg':
Metadata:
encoder : Lavf53.32.100
Stream #0:0: Video: mjpeg, yuvj420p, 1024x576 [SAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> mjpeg)
Press [q] to stop, [?] for help
frame= 1 fps= 0 q=6.4 Lsize= 0kB time=00:00:00.04 bitrate=
0.0kbits/s
identify thumbnail.jpg
thumbnail.jpg JPEG 1024x576 1024x576+0+0 8-bit DirectClass 50.2KB 0.000u
0:00.000
4:3
ffmpeg -i p20130120155621.ts -ss 0 -vf thumbnail -frames:v 1 -vf
scale=iw*sar:ih thumbnail.jpg
ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 13 2013 20:25:12 with gcc 4.6.3
configuration: --prefix=/usr --libdir=/usr/lib64
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe'
--extra-cflags='-march=native -O2 -pipe' --extra-cxxflags='-O2 -pipe'
--disable-static --enable-gpl --enable-version3 --enable-postproc
--enable-avfilter --disable-stripping --disable-debug --disable-doc
--disable-network --disable-vaapi --disable-vdpau --disable-ffplay
--enable-libmp3lame --enable-libvo-aacenc --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-libfaac --enable-nonfree
--disable-indev=v4l --disable-indev=alsa --disable-indev=oss
--disable-indev=jack --enable-libv4l2 --disable-outdev=alsa
--disable-outdev=oss --disable-outdev=sdl --enable-libfreetype
--enable-libvpx --disable-amd3dnow --disable-amd3dnowext
--disable-altivec --disable-avx --disable-mmx2 --disable-ssse3
--disable-vis --disable-neon --cpu=host --enable-hardcoded-tables
libavutil 51. 35.100 / 51. 35.100
libavcodec 53. 61.100 / 53. 61.100
libavformat 53. 32.100 / 53. 32.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
[mpegts @ 0x7f8921a2e620] max_analyze_duration 5000000 reached at 5000000
Input #0, mpegts, from 'p20130120155621.ts':
Duration: 00:02:19.44, start: 1.376978, bitrate: 2479 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Constrained Baseline)
([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps,
25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: mp3 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16, 128 kb/s
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting
format 'yuvj420p'
[buffer @ 0x7f8921a33250] w:720 h:576 pixfmt:yuv420p tb:1/1000000
sar:16/15 sws_param:
[scale @ 0x7f8921a34bd0] w:720 h:576 fmt:yuv420p -> w:768 h:576
fmt:yuvj420p flags:0x4
Output #0, image2, to 'thumbnail.jpg':
Metadata:
encoder : Lavf53.32.100
Stream #0:0: Video: mjpeg, yuvj420p, 768x576 [SAR 1:1 DAR 4:3],
q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
frame= 1 fps= 0 q=6.2 Lsize= 0kB time=00:00:00.04 bitrate=
0.0kbits/s dup=4 drop=0
identify thumbnail.jpg
thumbnail.jpg JPEG 768x576 768x576+0+0 8-bit DirectClass 48.9KB 0.000u
0:00.000
Thanks
Thomas S
More information about the ffmpeg-user
mailing list