Opened 10 years ago
Closed 8 years ago
#4079 closed enhancement (fixed)
Support odd cropping for subsampled formats.
Reported by: | LordHDL | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avfilter |
Version: | git-master | Keywords: | crop |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug: Screen capture with AV Foundation has an extra pixel width when cropping.
How to reproduce: Record screen with AV Foundation and use -vf crop.
./ffmpeg -f avfoundation -pix_fmt uyvy422 -video_device_index 3 -audio_device_index 3 -i "" -r 60 -c:v libx264 -crf 0 -vf crop=426:240:507:339 -c:a pcm_s16le -ar 48000 out.mov ffmpeg 2.4.3 built on November 4, 2014
Here are some files that showcase this: https://www.dropbox.com/sh/kt56y302cpzmo42/AACK6OwyB3wf82BHG7cJMS_Pa?dl=0
Change History (25)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Sorry, I'm not quite sure how to acquire that version. I've been downloading the releases posted here: http://www.evermeet.cx/ffmpeg/snapshots/
comment:4 by , 10 years ago
Not quite sure what you mean? I've tried many versions including the latest snapshot posted there. Refer to the images and videos I linked to above. Cropping is done incorrectly in as you can see a tiny bit of my desktop (to the left) as well as a bit of the window's title bar at the top. If I change the offset by one pixel, you'll see a bit of desktop on the right and bottom edges instead.
This doesn't seem to be present with Windows screen capture, as I asked a friend of mine to test it and his video was cropped correctly.
comment:5 by , 10 years ago
Please provide the command line and the complete, uncut console output for the latest snapshot (which is current git head as far as I am concerned).
comment:6 by , 10 years ago
Last login: Tue Nov 4 14:46:57 on ttys001 HDLs-MacBook-Pro:~ HDL$ cd ~/Desktop HDLs-MacBook-Pro:Desktop HDL$ ./ffmpeg -f avfoundation -video_device_index 3 -i "" -c:v mpeg4 -qscale 2 -vf crop=426:240:507:339 out.avi ffmpeg version N-67454-g0971154-tessus Copyright (c) 2000-2014 the FFmpeg developers built on Nov 3 2014 23:27:57 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) configuration: --cc=/usr/bin/clang --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr --enable-libwavpack --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb --enable-runtime-cpudetect libavutil 54. 11.100 / 54. 11.100 libavcodec 56. 10.102 / 56. 10.102 libavformat 56. 12.100 / 56. 12.100 libavdevice 56. 2.100 / 56. 2.100 libavfilter 5. 2.102 / 5. 2.102 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 2014-11-04 14:47:40.857 ffmpeg[3209:200060] alloc 2014-11-04 14:47:40.857 ffmpeg[3209:200060] query 2 2014-11-04 14:47:40.857 ffmpeg[3209:200060] release 2 2014-11-04 14:47:40.858 ffmpeg[3209:200060] ** MyPlugInitializeWithObjectID 2014-11-04 14:47:40.858 ffmpeg[3209:200060] init 2014-11-04 14:47:40.858 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.858 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.858 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.939 ffmpeg[3209:200060] <CMVideoFormatDescription 0x7fbb90d3b490 [0x7fff7bfb7cf0]> { mediaType:'vide' mediaSubType:'BGRA' mediaSpecific: { codecType: 'BGRA' dimensions: 640 x 480 } extensions: {<CFBasicHash 0x7fbb90d3d650 [0x7fff7bfb7cf0]>{type = immutable dict, count = 4, entries => 1 : <CFString 0x7fff7c3e2f08 [0x7fff7bfb7cf0]>{contents = "CVFieldCount"} = <CFNumber 0x137 [0x7fff7bfb7cf0]>{value = +1, type = kCFNumberSInt64Type} 2 : <CFString 0x10999b7f0 [0x7fff7bfb7cf0]>{contents = "CVBytesPerRow"} = <CFNumber 0xa0037 [0x7fff7bfb7cf0]>{value = +2560, type = kCFNumberSInt64Type} 4 : <CFString 0x7fff7a4d8e50 [0x7fff7bfb7cf0]>{contents = "com.apple.cmio.format_extension.video.only_has_i_frames"} = <CFBoolean 0x7fff7bfb86c8 [0x7fff7bfb7cf0]>{value = true} 5 : <CFString 0x7fff7b59d6f0 [0x7fff7bfb7cf0]>{contents = "FormatName"} = <CFString 0x10999b810 [0x7fff7bfb7cf0]>{contents = "Component Video - CCIR-601 RGB"} } } } 2014-11-04 14:47:40.940 ffmpeg[3209:200060] alloc 2014-11-04 14:47:40.940 ffmpeg[3209:200060] query 2 2014-11-04 14:47:40.940 ffmpeg[3209:200060] release 2 2014-11-04 14:47:40.940 ffmpeg[3209:200060] ** MyPlugInitializeWithObjectID 2014-11-04 14:47:40.940 ffmpeg[3209:200060] init 2014-11-04 14:47:40.940 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.940 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.940 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:40.941 ffmpeg[3209:200060] <CMVideoFormatDescription 0x7fbb90f1c6b0 [0x7fff7bfb7cf0]> { mediaType:'vide' mediaSubType:'2vuy' mediaSpecific: { codecType: '2vuy' dimensions: 640 x 480 } extensions: {<CFBasicHash 0x7fbb90e110e0 [0x7fff7bfb7cf0]>{type = immutable dict, count = 6, entries => 0 : <CFString 0x7fff7c3e3088 [0x7fff7bfb7cf0]>{contents = "CVImageBufferYCbCrMatrix"} = <CFString 0x7fff7c3e30c8 [0x7fff7bfb7cf0]>{contents = "ITU_R_601_4"} 1 : <CFString 0x7fff7c3e2f08 [0x7fff7bfb7cf0]>{contents = "CVFieldCount"} = <CFNumber 0x137 [0x7fff7bfb7cf0]>{value = +1, type = kCFNumberSInt64Type} 2 : <CFString 0x7fff7c3e3188 [0x7fff7bfb7cf0]>{contents = "CVImageBufferTransferFunction"} = <CFString 0x7fff7c3e30a8 [0x7fff7bfb7cf0]>{contents = "ITU_R_709_2"} 4 : <CFString 0x7fff7a4d8e50 [0x7fff7bfb7cf0]>{contents = "com.apple.cmio.format_extension.video.only_has_i_frames"} = <CFBoolean 0x7fff7bfb86c8 [0x7fff7bfb7cf0]>{value = true} 5 : <CFString 0x7fff7c3e3108 [0x7fff7bfb7cf0]>{contents = "CVImageBufferColorPrimaries"} = <CFString 0x7fff7c3e3148 [0x7fff7bfb7cf0]>{contents = "SMPTE_C"} 6 : <CFString 0x7fff7b59d6f0 [0x7fff7bfb7cf0]>{contents = "FormatName"} = <CFString 0x10999b870 [0x7fff7bfb7cf0]>{contents = "Component Video - CCIR-601 uyvy"} } } } 2014-11-04 14:47:41.043 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.043 ffmpeg[3209:200060] enog 2014-11-04 14:47:41.043 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.043 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.043 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.043 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.043 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.043 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.044 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.044 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.044 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.044 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.044 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.044 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.044 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.044 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.044 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.045 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.045 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.045 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.045 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.045 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.045 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.045 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.045 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.045 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.045 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.046 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.046 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.046 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.046 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.046 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.046 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.046 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.046 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.046 ffmpeg[3209:200060] grrf 2014-11-04 14:47:41.046 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.047 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.047 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.047 ffmpeg[3209:200060] grrf 2014-11-04 14:47:41.047 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.047 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.047 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.047 ffmpeg[3209:200060] trfn 2014-11-04 14:47:41.047 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.047 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.047 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.048 ffmpeg[3209:200060] trfm 2014-11-04 14:47:41.048 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.048 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.048 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.048 ffmpeg[3209:200060] trfn 2014-11-04 14:47:41.048 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.048 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.048 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.048 ffmpeg[3209:200060] dulp 2014-11-04 14:47:41.048 ffmpeg[3209:200060] tpni 2014-11-04 14:47:41.049 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.049 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.049 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.049 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.049 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.049 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.049 ffmpeg[3209:200060] enog 2014-11-04 14:47:41.049 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.049 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.049 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.050 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.050 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.050 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.050 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.050 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.050 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.050 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.051 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.051 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.051 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.051 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.051 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.051 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.051 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.052 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.052 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.052 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.052 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.052 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.052 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.052 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.052 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.053 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.053 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.053 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.053 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.053 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.053 ffmpeg[3209:200060] elt 0 2014-11-04 14:47:41.053 ffmpeg[3209:200060] MyPlugObjectSetPropertyData 2014-11-04 14:47:41.053 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.053 ffmpeg[3209:200060] grrf 2014-11-04 14:47:41.053 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.054 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.054 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.054 ffmpeg[3209:200060] grrf 2014-11-04 14:47:41.054 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.054 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.054 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.054 ffmpeg[3209:200060] trfn 2014-11-04 14:47:41.054 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.054 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.054 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.055 ffmpeg[3209:200060] trfm 2014-11-04 14:47:41.055 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.055 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.055 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.055 ffmpeg[3209:200060] trfn 2014-11-04 14:47:41.055 ffmpeg[3209:200060] bolg 2014-11-04 14:47:41.055 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.055 ffmpeg[3209:200060] MyPlugObjectHasProperty 2014-11-04 14:47:41.055 ffmpeg[3209:200060] dulp 2014-11-04 14:47:41.055 ffmpeg[3209:200060] tpni 2014-11-04 14:47:41.056 ffmpeg[3209:200060] 0 2014-11-04 14:47:41.056 ffmpeg[3209:200060] MyPlugObjectGetPropertyDataSize 2014-11-04 14:47:41.056 ffmpeg[3209:200060] sel dnwo 2014-11-04 14:47:41.056 ffmpeg[3209:200060] scope bolg 2014-11-04 14:47:41.056 ffmpeg[3209:200060] elt 0 [avfoundation @ 0x7fbb91806000] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fbb91806000] Supported pixel formats: [avfoundation @ 0x7fbb91806000] uyvy422 [avfoundation @ 0x7fbb91806000] yuyv422 [avfoundation @ 0x7fbb91806000] nv12 [avfoundation @ 0x7fbb91806000] 0rgb [avfoundation @ 0x7fbb91806000] bgr0 [avfoundation @ 0x7fbb91806000] Overriding selected pixel format to use uyvy422 instead. [avfoundation @ 0x7fbb91806000] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, avfoundation, from '': Duration: N/A, start: 0.409295, bitrate: 2822 kb/s Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1440x900, 1000k tbr, 1000k tbn, 1000k tbc Stream #0:1: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s Please use -q:a or -q:v, -qscale is ambiguous File 'out.avi' already exists. Overwrite ? [y/N] y [avi @ 0x7fbb9283b400] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2 Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf56.12.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 426x240, q=2-31, 200 kb/s, 65535 fps, 600 tbn, 65535 tbc Metadata: encoder : Lavc56.10.102 mpeg4 Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp Metadata: encoder : Lavc56.10.102 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native)) Stream #0:1 -> #0:1 (pcm_f32le (native) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help frame= 11 fps=0.0 q=2.0 size= 121kB time=00:00:02.65 bitrate= 374.3kbits/sframe= 18 fps= 18 q=2.0 size= 285kB time=00:00:03.12 bitrate= 746.3kbits/sframe= 26 fps= 17 q=2.0 size= 429kB time=00:00:03.65 bitrate= 960.7kbits/sframe= 34 fps= 17 q=2.0 size= 636kB time=00:00:04.19 bitrate=1243.7kbits/sframe= 41 fps= 16 q=2.0 size= 838kB time=00:00:04.65 bitrate=1474.1kbits/sframe= 49 fps= 16 q=2.0 size= 1210kB time=00:00:05.18 bitrate=1910.5kbits/sframe= 57 fps= 16 q=2.0 size= 1651kB time=00:00:05.72 bitrate=2363.4kbits/sframe= 64 fps= 16 q=2.0 size= 1997kB time=00:00:06.18 bitrate=2644.2kbits/sframe= 72 fps= 16 q=2.0 size= 2412kB time=00:00:06.72 bitrate=2939.6kbits/sframe= 79 fps= 16 q=2.0 size= 2772kB time=00:00:07.19 bitrate=3155.8kbits/sframe= 87 fps= 16 q=2.0 size= 3121kB time=00:00:07.72 bitrate=3312.2kbits/sframe= 95 fps= 16 q=2.0 size= 3347kB time=00:00:08.25 bitrate=3322.3kbits/sframe= 102 fps= 15 q=2.0 size= 3446kB time=00:00:08.73 bitrate=3233.7kbits/sframe= 110 fps= 15 q=2.0 size= 3509kB time=00:00:09.25 bitrate=3106.8kbits/sframe= 113 fps= 15 q=2.0 Lsize= 3708kB time=00:00:09.53 bitrate=3185.8kbits/s video:3439kB audio:118kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.268150% 2014-11-04 14:47:50.760 ffmpeg[3209:200060] MyPlugTeardown 2014-11-04 14:47:50.761 ffmpeg[3209:200060] MyPlugTeardown HDLs-MacBook-Pro:Desktop HDL$
comment:7 by , 10 years ago
Please test the following:
$ ffmpeg -f avfoundation -video_device_index 3 -i "" -vframes 1 -vcodec rawvideo out.nut
$ ffmpeg -i out.nut -c:v mpeg4 -qscale 2 -vf crop=426:240:507:339 out.avi
Does FFplay show the issue for one or both of the output files?
comment:8 by , 10 years ago
It shows for both. Full screen image (look at the left edge): https://www.dropbox.com/s/ho2imusdl325k5e/Full%20screen.png?dl=0
However there is a difference on the console output that I noticed between the two. The 2nd command shows this:
[swscaler @ 0x7ffae2007800] Warning: data is not aligned! This can lead to a speedloss [mpeg4 @ 0x7ffae2002800] ignoring invalid SAR: 0/0
Full command:
Last login: Tue Nov 4 15:09:54 on ttys001 HDLs-MacBook-Pro:~ HDL$ cd ~/Desktop HDLs-MacBook-Pro:Desktop HDL$ ./ffmpeg -i out.nut -c:v mpeg4 -qscale 2 -vf crop=426:240:507:339 out.avi ffmpeg version N-67454-g0971154-tessus Copyright (c) 2000-2014 the FFmpeg developers built on Nov 3 2014 23:27:57 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) configuration: --cc=/usr/bin/clang --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr --enable-libwavpack --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb --enable-runtime-cpudetect libavutil 54. 11.100 / 54. 11.100 libavcodec 56. 10.102 / 56. 10.102 libavformat 56. 12.100 / 56. 12.100 libavdevice 56. 2.100 / 56. 2.100 libavfilter 5. 2.102 / 5. 2.102 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, nut, from 'out.nut': Metadata: encoder : Lavf56.12.100 Duration: 00:00:00.00, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 426x240, 1000k tbr, 1000k tbn, 1000k tbc Metadata: encoder : Lavc56.10.102 rawvideo Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp Metadata: encoder : Lavc56.10.102 libvorbis Please use -q:a or -q:v, -qscale is ambiguous File 'out.avi' already exists. Overwrite ? [y/N] y [avi @ 0x7ffae2001c00] Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or -vsync 2 Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf56.12.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 426x240, q=2-31, 200 kb/s, 65535 fps, 600 tbn, 65535 tbc Metadata: encoder : Lavc56.10.102 mpeg4 Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp Metadata: encoder : Lavc56.10.102 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native)) Stream #0:1 -> #0:1 (vorbis (native) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help [swscaler @ 0x7ffae2007800] Warning: data is not aligned! This can lead to a speedloss [mpeg4 @ 0x7ffae2002800] ignoring invalid SAR: 0/0 Last message repeated 2 times frame= 1 fps=0.0 q=2.0 Lsize= 86kB time=00:00:00.00 bitrate=N/A video:76kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 12.708453% HDLs-MacBook-Pro:Desktop HDL$
comment:10 by , 10 years ago
My mistake, I was actually comparing 2 cropping tests so I'm wrong on them both being the same.
The 1st command seems fine, I can't see anything wrong with the edges.
The issue is definitely with cropping. However I noticed a difference between using your commands and trying to crop with my recording attempts from earlier. The image above only shows the issue on the left edge, but in my recording attempts I saw it with both width and height (see everything I originally linked to).
comment:11 by , 10 years ago
I am unable to reproduce your issue on a MacBook Air.
If out.nut looks ok but converting it allows to reproduce the issue, please upload it.
comment:12 by , 10 years ago
Here is a direct screen shot from the source using the same offset values: https://www.dropbox.com/s/64iwf6kmyxvzupl/Source.png?dl=0
Here is the result of using the 2 commands you gave: https://www.dropbox.com/s/jwja2554d15f827/out.avi?dl=0
In out.avi the top shows a bit of the window title bar and the left edge shows my desktop.
comment:15 by , 10 years ago
Could the issue be that the window you want to record is actually only 425x239?
comment:16 by , 10 years ago
It's not. Check Source.png, it's captured at 426x240 with the origin point at 507:339. Likewise, other software like ScreenFlow and CocoaSplit crop it without issue.
comment:18 by , 10 years ago
Work-around for the recorded file is to use -vf format=rgb24,crop...
but since this involves two colour space conversions, setting the rgb input pix_fmt should be the better solution.
comment:19 by , 10 years ago
Component: | undetermined → avfilter |
---|---|
Keywords: | crop added |
Priority: | normal → wish |
Reproduced by developer: | set |
Status: | new → open |
Summary: | Screen capture with AV Foundation has an extra pixel width when cropping → Support yuyv422 and uyvy422 as input formats for the crop filter |
Type: | defect → enhancement |
Version: | 2.4.3 → git-master |
A better work-around for the input file is -vf format=yuv444p,crop=426:240:507:339
.
comment:20 by , 10 years ago
Thanks, those all worked for correct cropping. However I did notice a problem with -vf format=yuv444p
: https://www.dropbox.com/s/g6xzwjea0jwbjf8/yuv444p.png?dl=0
The left and right edges seem to be noticeably darkened.
Compare with -pix_fmt 0rgb
: https://www.dropbox.com/s/oq8ree5jzfzx5ci/0rgb.png?dl=0
This one doesn't have the darkened edges yuv444p has.
In any case I'm curious, are these formats color accurate?
comment:21 by , 10 years ago
Unrelated: Could you provide a Screenflow scc file for our samples collection?
comment:22 by , 10 years ago
Sorry for the delay. https://www.dropbox.com/s/k0vxod1qh3q04r1/SCC%20sample.zip?dl=0
comment:23 by , 8 years ago
My ticket https://trac.ffmpeg.org/ticket/5654 was closed as a duplicate to this one, though I'm not sure if it's even the same symptoms (None of these dropbox links work). My ticket is not an enhancement request, my screen capture output is completely garbled. If this enhancement is stuck, I recommend reopening my defect ticket for capturing video on OSX at 1366x768 resolution. So far I have not found any commit in ffmpeg where this is working. Otherwise I'll just say the workaround mentioned above has no effect for my problem.
comment:25 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Summary: | Support yuyv422 and uyvy422 as input formats for the crop filter → Support odd cropping for subsampled formats. |
Fixed by Paul in 4d7d74802d0c857d365f95d7cd712581cce93323, needs exact=1
.
To make this a valid ticket, please test current FFmpeg git head and please provide the command line that allows to reproduce your issue together with the complete, uncut console output.