Transcoding with custom commands using streamio-ffmpeg -
i'm trying transcode video file using streamio-ffmpeg
custom commands, nothing try seems work. want transcode video following options:
ffmpeg -i input.mp4 -vf "format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4
i've tried following code combinations without success:
tried removing line breaks , converting command string array, following instructions in docs.
video = ffmpeg::movie.new('input.mp4') opts = %w(ffmpeg -i input.mp4 -vf "format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4) video.transcode('output.mp4', opts)
but yields error:
[null @ 0x7f962100e200] unable find suitable output format 'ffmpeg' ffmpeg: invalid argument /users/acidstealth/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
tried stripping out input file name , output file name since gem seems handle you.
video = ffmpeg::movie.new('input.mp4') opts = %w(-vf "format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p") video.transcode('output.mp4', opts)
which returns error:
[null @ 0x7fd0a9008c00] unable find suitable output format 'drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max,' drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max,: invalid argument /users/acidstealth/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
tried removing
-vf
flag , running within quotation marks.video = ffmpeg::movie.new('input.mp4') opts = %w(format=yuv444p, drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th, format=yuv420p) video.transcode('output.mp4', opts)
this returns error:
[null @ 0x7fab8101fe00] unable find suitable output format 'format=yuv444p,' format=yuv444p,: invalid argument /users/acidstealth/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
tried removing
format
arguments since ffmpeg complaining those.video = ffmpeg::movie.new('input.mp4') opts = %w("drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='opensans-regular,sans':text='custom text':fontcolor=0xffffff:fontsize=24:x=(w-tw)/2:y=(h/phi)+th") video.transcode('output.mp4', opts)
again error:
[null @ 0x7fc7f880a800] unable find suitable output format 'drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max,' drawbox=y=ih/phi:color=0x000000@0.4:width=iw:height=48:t=max,: invalid argument /users/acidstealth/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
tried building hash command string , feeding
transcode
method.video = ffmpeg::movie.new('input.mp4') opts = { '-vf' => { format: 'yuv444p', drawbox: { y: 'ih/phi', color: '0x000000@0.4', width: 'iw', height: '48', t: 'max' }, drawtext: { font: 'opensans-regular,sans', text: snap.title, fontcolor: '0xffffff', fontsize: '24', x: '(w-tw)/2', y: '(h/phi)+th' }, format: 'yuv420p' } } video.transcode('output.mp4', opts)
i tried variation without
-vf
flag:video = ffmpeg::movie.new('input.mp4') opts = { format: 'yuv444p', drawbox: { y: 'ih/phi', color: '0x000000@0.4', width: 'iw', height: '48', t: 'max' }, drawtext: { font: 'opensans-regular,sans', text: snap.title, fontcolor: '0xffffff', fontsize: '24', x: '(w-tw)/2', y: '(h/phi)+th' }, format: 'yuv420p' } video.transcode('output.mp4', opts)
these both produced output.mp4
video file output file unchanged input. there no text overlay.
nothing try seems work. doing wrong here?
Comments
Post a Comment