I am using .net ffmpeg wrapper to post watermark on videos. Posting watermark works fine if i execute ffmpeg command directly but failed to find suitable watermark png file location if command executed via asp.net application.
here is sample ffmpeg command
string RootPath = HttpContext.Current.Server.MapPath(HttpContext.Current.Request.ApplicationPath);
_mhandler.FFMPEGPath = RootPath + "/ffmpeg_aug_2013/bin/ffmpeg.exe";
_mhandler.InputPath = RootPath + "/contents/original";
_mhandler.OutputPath = RootPath + "/contents/mp4";
_mhandler.BackgroundProcessing = false;
_mhandler.FileName = "wildlife.wmv";
_mhandler.OutputFileName = "wildlife_ddd";
string presetpath = RootPath + "/ffmpeg_aug_2013/presets/libx264-ipod640.ffpreset";
_mhandler.OutputExtension = ".mp4";
_mhandler.Parameters = "-s 640x380 -b:v 500k -bufsize 500k -b:a 128k -ar 44100 -c:v libx264 -vf \"movie = watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]\"";
_mhandler.Parameters = _mhandler.Parameters + " -fpre \"" + presetpath + "\"";
VideoInfo info = _mhandler.Process();
i tried direct code too
string _out = "";
Process _process = new Process();
_process.StartInfo.UseShellExecute = false;
_process.StartInfo.RedirectStandardInput = true;
//_process.StartInfo.RedirectStandardOutput = true;
_process.StartInfo.RedirectStandardError = true;
_process.StartInfo.CreateNoWindow = true;
_process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
_process.StartInfo.FileName = _ffmpegpath;
_process.StartInfo.Arguments = cmd;
if (_process.Start())
{
_process.WaitForExit(ExitProcess);
_out = _process.StandardError.ReadToEnd();
if (!_process.HasExited)
_process.Kill();
return _out;
}
ffmpeg error output as
FFMPEG Output:ffmpeg version N-55753-g88909be Copyright (c) 2000-2013 the FFmpeg developers built on Aug 24 2013 21:40:51 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 42.100 / 52. 42.100 libavcodec 55. 29.100 / 55. 29.100 libavformat 55. 14.102 / 55. 14.102 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 82.102 / 3. 82.102 libswscale 2. 5.100 / 2. 5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 [asf @ 024c9960] Stream #0: not enough frames to estimate rate; consider increasing probesize Guessed Channel Layout for Input Stream
0.0 : stereo Input #0, asf, from 'F:\own\mhp_new/contents/original\wildlife.wmv': Metadata:
SfOriginalFPS : 299700 WMFSDKVersion : 11.0.6001.7000 WMFSDKNeeded : 0.0.0.0000 comment : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball title : Wildlife in HD copyright : © 2008 Microsoft Corporation IsVBR : 0 DeviceConformanceTemplate: AP@L3 Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s Stream #0:0(eng): Audio: wmav2 (a1[0][0] / 0x0161), 44100 Hz, stereo, fltp, 192 kb/s Stream
0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc [image2 @ 024c76e0]
Could find no file with path 'watermark.png' and index in the range 0-4 [Parsed_movie_0 @ 024c0540] Failed to avformat_open_input 'watermark.png' [AVFilterGraph @ 024ca100] Error initializing filter 'movie' with args 'watermark.png' Error opening filters! Error Code= 0
Error on point ( Could find no file with path 'watermark.png' ) shows watermark.png file not found. I place watermark.png file in the following locations but still can't found
i: application root
ii: root where actual aspx page located
iii: ffmpeg root
iv: ffmpeg/bin/
I also used complete path but still can't detected.
Note: if i use same ffmpeg command in php and place watermark.png on location where actual php page exist watermark properly detected and command executed properly, but same approach not working in asp.net
Can any one help me where should i place watermark.png file so that script can access it.
_mhandler.Process()
and whatever is a dependency of it). – nmaier