Brighten dark video before reducing size?
Hello Using a basic Sony camcorder, I recorded a two-hour conference whose picture is a bit dark. I tried applying a filter in AviDemux and saving the file, but for some reason, there's no sound when played in VLC :-/ Before trying other NLE applications (VirtualDub, Sony Vegas, etc.), I was wondering if ffmpeg could apply some filters before further reducing the filesize? FWIW... 1. here's what the original file looks like: Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s 2. Using the following command, ffmpeg reduces the original 9GB to 340MB: ffmpeg -i input.mpg -c:v libx264 -vf scale=iw/2:-1 -preset faster -c:a ac3 -ab 192k output.mp4 Thank you.
Gilles <codecomplete <at> free.fr> writes:
I was wondering if ffmpeg could apply some filters before further reducing the filesize?
Definitely, please see the fine filter documentation: http://ffmpeg.org/ffmpeg.html#Video-Filters (hue, lut, geq and mp=eq2 come to mind.) Carl Eugen
On Tue, 11 Dec 2012 11:31:49 +0000 (UTC), Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
Definitely, please see the fine filter documentation: http://ffmpeg.org/ffmpeg.html#Video-Filters (hue, lut, geq and mp=eq2 come to mind.)
Thank you.
On Tue, 11 Dec 2012 11:31:49 +0000 (UTC), Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
I was wondering if ffmpeg could apply some filters before further reducing the filesize?
Definitely, please see the fine filter documentation: http://ffmpeg.org/ffmpeg.html#Video-Filters (hue, lut, geq and mp=eq2 come to mind.)
I've tried the following commands, but none worked to brighten a dark video: I tried each of those commands, but observed no change: -vf mp=eq2=1:1.68:0.3:1.25:1:0.96:1 -vf "lutyuv=y=val*1.3" -vf "lutyuv=y=val*2.0" -filter:v lutyuv="y=gammaval(0.7)" Here's how I used the command, where HERE contained one of the switches above ffmpeg -ss 00:05:00 -t 20 -i input.mp4 HERE -vf scale=640:-1 -c:v libx264 -pix_fmt yuv420p -c:a copy -shortest -f mp4 output.mp4 Thank you. PS: More information about the input file: c:\>ffprobe.exe -i input.mp4 ffprobe version N-66595-g1c4c78e Copyright (c) 2007-2014 the FFmpeg developers built on Oct 3 2014 22:01:53 with gcc 4.9.1 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable- libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 54. 9.100 / 54. 9.100 libavcodec 56. 2.101 / 56. 2.101 libavformat 56. 7.104 / 56. 7.104 libavdevice 56. 1.100 / 56. 1.100 libavfilter 5. 1.102 / 5. 1.102 libswscale 3. 1.100 / 3. 1.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 1.100 / 53. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.18.100 Duration: 00:27:31.04, start: 0.000000, bitrate: 1415 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1283 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12 5 kb/s (default) Metadata: handler_name : SoundHandler
Gilles <codecomplete <at> free.fr> writes:
On Tue, 11 Dec 2012 11:31:49 +0000 (UTC), Carl Eugen Hoyos <cehoyos <at> ag.or.at> wrote:
I was wondering if ffmpeg could apply some filters before further reducing the filesize?
Definitely, please see the fine filter documentation: http://ffmpeg.org/ffmpeg.html#Video-Filters (hue, lut, geq and mp=eq2 come to mind.)
I've tried the following commands, but none worked to brighten a dark video:
Note that this answer to a two-year old email is quite disturbing to me... (But that may absolutely only be me!) [...]
Here's how I used the command, where HERE contained one of the switches above
Please never post command lines that contain variables, always post actual command lines that you tested including their complete, uncut console output. As far as I am concerned, using -vf filter1 -vf filter2 is either undefined behaviour or not supported, the filter option does support multiple filters. Carl Eugen
On Mon, 6 Oct 2014 09:51:51 +0000 (UTC), Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
Please never post command lines that contain variables, always post actual command lines that you tested including their complete, uncut console output.
As far as I am concerned, using -vf filter1 -vf filter2 is either undefined behaviour or not supported, the filter option does support multiple filters.
This does display the video like I'd like it to look: ffplay -i input.mp4 -vf "lutyuv=y=val*1.3" Next, I tried combining the two "vf" commands, but it didn't work: ========================== c:\>ffmpeg -ss 00:05:00 -t 20 -i input.mp4 -vf lutyuv=y=val*1.3 scale=640:-1 -c:v libx264 -pix_fmt yuv420p -c:a copy -shortest -f mp4 output.mp4 ffmpeg version N-66595-g1c4c78e Copyright (c) 2000-2014 the FFmpeg developers built on Oct 3 2014 22:01:53 with gcc 4.9.1 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable- libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 54. 9.100 / 54. 9.100 libavcodec 56. 2.101 / 56. 2.101 libavformat 56. 7.104 / 56. 7.104 libavdevice 56. 1.100 / 56. 1.100 libavfilter 5. 1.102 / 5. 1.102 libswscale 3. 1.100 / 3. 1.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 1.100 / 53. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.18.100 Duration: 00:27:31.04, start: 0.000000, bitrate: 1415 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1283 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12 5 kb/s (default) Metadata: handler_name : SoundHandler [NULL @ 0414d840] Unable to find a suitable output format for 'scale=640:-1' scale=640:-1: Invalid argument ffmpeg -ss 00:05:00 -t 20 -i input.mp4 -vf "lutyuv=y=val*1.3 scale=640:-1" -c:v libx264 -pix_fmt yuv420p -c:a copy -shortest -f mp4 output.mp4 ========================== c:\>ffmpeg -ss 00:05:00 -t 20 -i input.mp4 -vf "lutyuv=y=val*1.3 scale=640:-1" -c:v libx264 -pix_fmt yuv420p -c:a copy -shortest -f mp4 output.mp4 ffmpeg version N-66595-g1c4c78e Copyright (c) 2000-2014 the FFmpeg developers built on Oct 3 2014 22:01:53 with gcc 4.9.1 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable- libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 54. 9.100 / 54. 9.100 libavcodec 56. 2.101 / 56. 2.101 libavformat 56. 7.104 / 56. 7.104 libavdevice 56. 1.100 / 56. 1.100 libavfilter 5. 1.102 / 5. 1.102 libswscale 3. 1.100 / 3. 1.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 1.100 / 53. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.18.100 Duration: 00:27:31.04, start: 0.000000, bitrate: 1415 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1283 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12 5 kb/s (default) Metadata: handler_name : SoundHandler [Parsed_lutyuv_0 @ 04054f00] [Eval @ 0022af8c] Invalid chars 'scale=640' at the end of expression 'val*1.3 scale=640' [Parsed_lutyuv_0 @ 04054f00] Error when parsing the expression 'val*1.3 scale=64 0' for the component 0 and color 0. [Parsed_lutyuv_0 @ 04054f00] Failed to configure input pad on Parsed_lutyuv_0 Error opening filters!
Gilles <codecomplete <at> free.fr> writes:
c:\>ffmpeg -ss 00:05:00 -t 20 -i input.mp4 -vf lutyuv=y=val*1.3 scale=640:-1
I suspect this should be: -vf lutyuv=y=val*1.3,scale=640:-1 But I suggest you first try without scaling to find the right syntax to brighten your video. Carl Eugen
On Mon, 6 Oct 2014 11:24:46 +0000 (UTC), Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
I suspect this should be: -vf lutyuv=y=val*1.3,scale=640:-1
Problem solved with the folllowing: ffmpeg -i input.mp4 -vf mp=eq2=1:1.68:0.3:1.25:1:0.96:1,scale=640:-1,format=pix_fmts=yuv420p -c:v libx264 -c:a copy -shortest -f mp4 output.mp4 Thank you.
participants (2)
-
Carl Eugen Hoyos -
Gilles