Wondering why
ffmpeg -i 4sec720x480dv.mov \
-filter_complex \
"scale=w=1280:h=720:force_original_aspect_ratio=decrease,\
pad=w=1280:h=720:x='(ow-iw)/2':y=(oh-ih)/2"\
-pix_fmt yuv420p -c:v libx264 scale4.mp4
has audio
Stream mapping:
Stream #0:0 (h264) -> scale (graph 0)
pad (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
but (python3)
import ffmpeg
(
ffmpeg
.input('4sec720x480dv.mov')
.filter('scale', w=1280,h=720,force_original_aspect_ratio='decrease')
.filter('pad', w=1280, h=720,x='(ow-iw)/2',y='(oh-ih)/2')
.output('scale3.mp4',vcodec='libx264',pix_fmt='yuv420p')
.run()
)
Stream mapping:
Stream #0:0 (h264) -> scale
pad -> Stream #0:0 (libx264)
doesn't. Am I missing something?
same issue here.
I've the solution for this problem.
```python
import glob
import os
import ffmpeg
path = "videos/"
videos = glob.glob(path + "*.mp4")
for video in videos:
aud = ffmpeg.input(video).audio
vid = ffmpeg.input(video).video.filter('scale', size='1920x1080', force_original_aspect_ratio='decrease').filter('pad', '1920', '1080', '(ow-iw)/2', '(oh-ih)/2')
aspect = ffmpeg.concat(vid, aud, v=1, a=1)
out = ffmpeg.output(vid, aud, "scaled3.mp4" )
out.run()
````
awsm I had seen something in the documentation about treating audio and video separately, but it was confusing to me. This is an elegant solution. I'm kind of new to this, should I now close this issue?
Thanks, you can close it.
Most helpful comment
I've the solution for this problem.
```python
import glob
import os
import ffmpeg
path to video files
path = "videos/"
videos = glob.glob(path + "*.mp4")
for video in videos:
aud = ffmpeg.input(video).audio
vid = ffmpeg.input(video).video.filter('scale', size='1920x1080', force_original_aspect_ratio='decrease').filter('pad', '1920', '1080', '(ow-iw)/2', '(oh-ih)/2')
aspect = ffmpeg.concat(vid, aud, v=1, a=1)
out = ffmpeg.output(vid, aud, "scaled3.mp4" )
out.run()
````