Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5123 closed defect (needs_more_info)

PAD filter works correctly only when vcodec is NOT H264

Reported by: SarasotaSlim Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: pad
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: PAD filter works correctly only when vcodec is NOT H264
How to reproduce: Try it, with one of each

% ffmpeg -i input ... output
ffmpeg version
built on ...

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

MyTemplate? to grab 't-seconds' of a video file, starting 'ss-seconds' into it

ffmpeg -i MOVIE.mkv -acodec copy -vcodec copy -t 60 -ss 240 MOVIE-1min.mp4

So, I grabbed 180 secs (3 mins) of one of mine (it was ripped from a DVD using MakeMKV...720x480, vcodec=MPEG2) :

ffmpeg -i Raising_Arizona(1987).mkv -acodec copy -vcodec copy -t 600 -ss 60 Raising_Arizona-3mins.mkv


For this next part, you need be sure you have a FULL distrib of FFMPEG for Windows (that includes filters),
so if this next step fails because it can't find filters, get full version (static pkg, which has filters inside) here:

http://ffmpeg.zeranoe.com/builds/ (Look for the windows build section)


[ Problem initially found on Windows-10, using :

ffmpeg version N-77681-gb6c61b7 Copyright (c) 2000-2016 the FFmpeg developers

[ On my Debian-family-based Linux, I have version 2.8.3 of FFMPEG, which I also validated these findings against. ]

To pad, I followed this tutorial:

http://www.ehow.com/how_7623319_put-black-borders-ffmpeg.html


[ Some other FFMPEG pad info, such as this one, erroneously claim that you first need to 'scale', but that makes NO sense at all! ]

http://superuser.com/questions/547296/resizing-videos-with-ffmpeg-avconv-to-fit-into-static-sized-player

VLC can pad without scaling first, so FFMPEG should be able to, too. The VLC clause needed is simply:

--sout=#transcode{vfilter=croppadd{paddtop=40,paddbottom=40}

and note that VLC, unlike FFMPEG, is transparent to what the initial/final resolutions happen to be !

So using the pad-filter, I padded it via ffmpeg, from 720x480 to 720x540, with extra 30 top and bottom. [ It took 7 minutes. ]

ffmpeg -i Raising_Arizona-3mins.mkv -filter:v pad=720:540:0:30:black Raising_Arizona-ffmpeg-pad.mp4

Note that FFPEG's pad creates the output into H264 (whether you wanted that or not).

Then, I did the same pad, using VLC. It took only 2 minutes. [ Note that with VLC I'm using vcodec=mpeg4, not h264. To go to h264, takes 12 mins.]

vlc -vvv --extraintf logger --fullscreen --play-and-exit --no-osd --no-sub-autodetect-file --log-verbose=2 --verbose-objects=+all
--sout=#transcode{vfilter=croppadd{paddtop=30,paddbottom=30},vcodec=mpeg4,vb=1000,
acodec=mpga,ab=96,channels=2,threads=2}:std{access=file,mux=mp4,dst="C:\Users\David\mkv-files\Raising_Arizona-vlc-pad.mp4"}
"C:\Users\David\mkv-files\Raising_Arizona-3mins.mkv"

So I learned from this: Staying in MPEG2 or MPEG4 (until the final pass, where h264 is required for us), is the way to go. It is MUCH faster.

i.e I learned that FFMPEG's PAD filter REQUIRES them to put the output into h264 (which is what is slowing their padding time down). I also
found that when the INPUT file is already in h264, FFMPEG thinks it needs a bunch more stuff, like "-pix_fmt"..which appears to be broken.

Also, VLC is totally transparent to what the initial/final resolutions are, whereas FFMPEG requires you to phrase your request explicitly stating the target resolution.

Change History (9)

comment:1 Changed 3 years ago by cehoyos

Your report makes no sense at all.

If you want to make this a valid ticket, please test current FFmpeg git head and provide the FFmpeg command line that allows to reproduce your issue together withe the complete, uncut console output and please provide an input sample.

comment:2 Changed 3 years ago by SarasotaSlim

An example cmd line that either works or fails is:

ffmpeg -i Raising_Arizona-3mins.mkv -filter:v pad=720:540:0:30:black Raising_Arizona-ffmpeg-pad.mp4

To convince yourselves that you indeed have a bug,
all you have to do is create 2 small video segments...one w/ vcodec of H264 and
one with (say) MPEG2 or MPEG4 vcodec. The MPEG one(s) will work,
the H264 one will fail.

I was just trying to be helpful.
But, if you don't give a shit, I certainly don't !

(I use VLC to pad...which is superior to using FFMPEG in
all the ways that I mentioned.)

Cheers...

comment:3 Changed 3 years ago by richardpl

Pad filter doesn't require any codec, just you need to specify mpeg codec if you want it.

comment:4 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed
  • Version changed from 2.8.3 to unspecified

Please feel free to reopen this ticket if you can provide your command line together with the complete, uncut console output.

And please consider to post all questions related to filters and codecs and the FFmpeg command line syntax on the user mailing list:
https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-user/

comment:5 Changed 3 years ago by ubitux

According to the original post, the input needs to be 720x480 in MPEG2 and H.264. So I did the following:

☭ ./ffmpeg -f lavfi -i testsrc2=s=720x480:d=60 -c:v libx264 test-h264.mkv -c:v mpeg2video test-mpeg2.mkv
ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-debug --disable-stripping --enable-fontconfig --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmodplug --enable-libmp3lame --enable-libopus --enable-libpulse --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --samples=/home/ux/fate-samples --assert-level=2
  libavutil      55. 12.100 / 55. 12.100
  libavcodec     57. 21.100 / 57. 21.100
  libavformat    57. 21.101 / 57. 21.101
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 23.100 /  6. 23.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, lavfi, from 'testsrc2=s=720x480:d=60':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x55840d734b40] using SAR=1/1
[libx264 @ 0x55840d734b40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x55840d734b40] profile High, level 3.0
[libx264 @ 0x55840d734b40] 264 - core 148 r2579 73ae2d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'test-h264.mkv':
  Metadata:
    encoder         : Lavf57.21.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x480 [SAR 1:1 DAR 3:2], q=-1--1, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.21.100 libx264
    Side data:
      unknown side data type 10 (24 bytes)
Output #1, matroska, to 'test-mpeg2.mkv':
  Metadata:
    encoder         : Lavf57.21.101
    Stream #1:0: Video: mpeg2video (Main) (mpg2 / 0x3267706D), yuv420p, 720x480 [SAR 1:1 DAR 3:2], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.21.100 mpeg2video
    Side data:
      unknown side data type 10 (24 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:0 -> #1:0 (rawvideo (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
frame= 1500 fps=155 q=-1.0 Lq=31.0 size=    7370kB time=00:00:59.96 bitrate=1006.9kbits/s speed=6.18x    
video:10696kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x55840d734b40] frame I:6     Avg QP:14.38  size: 13694
[libx264 @ 0x55840d734b40] frame P:1027  Avg QP:25.73  size:  5352
[libx264 @ 0x55840d734b40] frame B:467   Avg QP:30.26  size:  4188
[libx264 @ 0x55840d734b40] consecutive B-frames: 43.7% 40.5% 11.2%  4.5%
[libx264 @ 0x55840d734b40] mb I  I16..4: 55.1% 29.7% 15.2%
[libx264 @ 0x55840d734b40] mb P  I16..4:  1.5%  2.8%  0.4%  P16..4:  8.8%  4.8%  3.2%  0.0%  0.0%    skip:78.5%
[libx264 @ 0x55840d734b40] mb B  I16..4:  0.3%  0.3%  0.2%  B16..8: 15.2%  3.4%  1.0%  direct: 1.9%  skip:77.7%  L0:48.7% L1:44.5% BI: 6.9%
[libx264 @ 0x55840d734b40] 8x8 transform intra:55.7% inter:18.5%
[libx264 @ 0x55840d734b40] coded y,uvDC,uvAC intra: 8.2% 14.4% 13.1% inter: 4.9% 8.9% 7.6%
[libx264 @ 0x55840d734b40] i16 v,h,dc,p: 81% 16%  2%  0%
[libx264 @ 0x55840d734b40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5%  9% 85%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x55840d734b40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 21% 31%  3%  3%  4%  4%  4%  4%
[libx264 @ 0x55840d734b40] i8c dc,h,v,p: 63% 12% 24%  1%
[libx264 @ 0x55840d734b40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55840d734b40] ref P L0: 54.5%  6.9% 23.5% 15.1%
[libx264 @ 0x55840d734b40] ref B L0: 72.4% 25.3%  2.3%
[libx264 @ 0x55840d734b40] ref B L1: 95.5%  4.5%
[libx264 @ 0x55840d734b40] kb/s:1004.62

To obtain

-rw-r--r-- 1 ux ux 7.2M Jan  6 15:30 test-h264.mkv
-rw-r--r-- 1 ux ux 3.3M Jan  6 15:30 test-mpeg2.mkv

Then tried to pad both:

☭ ./ffmpeg -i test-mpeg2.mkv -vf pad=720:540:0:30:black test-mpeg2-pad.mkv
ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-debug --disable-stripping --enable-fontconfig --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmodplug --enable-libmp3lame --enable-libopus --enable-libpulse --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --samples=/home/ux/fate-samples --assert-level=2
  libavutil      55. 12.100 / 55. 12.100
  libavcodec     57. 21.100 / 57. 21.100
  libavformat    57. 21.101 / 57. 21.101
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 23.100 /  6. 23.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test-mpeg2.mkv':
  Metadata:
    ENCODER         : Lavf57.21.101
  Duration: 00:01:00.00, start: 0.000000, bitrate: 457 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 1:1 DAR 3:2], max. 104857 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      ENCODER         : Lavc57.21.100 mpeg2video
      DURATION        : 00:01:00.000000000
[libx264 @ 0x556d98f38660] using SAR=1/1
[libx264 @ 0x556d98f38660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x556d98f38660] profile High, level 3.0
[libx264 @ 0x556d98f38660] 264 - core 148 r2579 73ae2d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'test-mpeg2-pad.mkv':
  Metadata:
    encoder         : Lavf57.21.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x540 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      DURATION        : 00:01:00.000000000
      encoder         : Lavc57.21.100 libx264
    Side data:
      unknown side data type 10 (24 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 1500 fps=150 q=-1.0 Lsize=    8573kB time=00:00:59.92 bitrate=1172.1kbits/s speed=5.97x    
video:8562kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.131952%
[libx264 @ 0x556d98f38660] frame I:6     Avg QP:13.82  size: 17628
[libx264 @ 0x556d98f38660] frame P:1143  Avg QP:23.67  size:  6392
[libx264 @ 0x556d98f38660] frame B:351   Avg QP:26.88  size:  3859
[libx264 @ 0x556d98f38660] consecutive B-frames: 59.4% 26.0%  6.6%  8.0%
[libx264 @ 0x556d98f38660] mb I  I16..4: 75.2% 15.6%  9.2%
[libx264 @ 0x556d98f38660] mb P  I16..4:  2.3%  4.0%  0.4%  P16..4: 11.4%  4.2%  1.9%  0.0%  0.0%    skip:75.8%
[libx264 @ 0x556d98f38660] mb B  I16..4:  0.5%  0.4%  0.1%  B16..8: 15.0%  2.2%  0.3%  direct: 5.3%  skip:76.3%  L0:51.7% L1:43.6% BI: 4.7%
[libx264 @ 0x556d98f38660] 8x8 transform intra:55.7% inter:58.8%
[libx264 @ 0x556d98f38660] coded y,uvDC,uvAC intra: 13.0% 45.5% 42.9% inter: 3.6% 13.4% 12.6%
[libx264 @ 0x556d98f38660] i16 v,h,dc,p: 67% 29%  4%  0%
[libx264 @ 0x556d98f38660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 10% 77%  1%  1%  0%  1%  0%  1%
[libx264 @ 0x556d98f38660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 16% 50%  1%  1%  1%  3%  1%  2%
[libx264 @ 0x556d98f38660] i8c dc,h,v,p: 47% 22% 29%  2%
[libx264 @ 0x556d98f38660] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x556d98f38660] ref P L0: 67.8%  8.5% 15.2%  8.5%
[libx264 @ 0x556d98f38660] ref B L0: 84.9% 13.9%  1.3%
[libx264 @ 0x556d98f38660] ref B L1: 97.0%  3.0%
[libx264 @ 0x556d98f38660] kb/s:1168.92
☭ ./ffmpeg -i test-h264.mkv -vf pad=720:540:0:30:black test-h264-pad.mkv
ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-debug --disable-stripping --enable-fontconfig --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmodplug --enable-libmp3lame --enable-libopus --enable-libpulse --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --samples=/home/ux/fate-samples --assert-level=2
  libavutil      55. 12.100 / 55. 12.100
  libavcodec     57. 21.100 / 57. 21.100
  libavformat    57. 21.101 / 57. 21.101
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 23.100 /  6. 23.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test-h264.mkv':
  Metadata:
    ENCODER         : Lavf57.21.101
  Duration: 00:01:00.00, start: 0.000000, bitrate: 1006 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      ENCODER         : Lavc57.21.100 libx264
      DURATION        : 00:01:00.000000000
[libx264 @ 0x561e713ee820] using SAR=1/1
[libx264 @ 0x561e713ee820] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x561e713ee820] profile High, level 3.0
[libx264 @ 0x561e713ee820] 264 - core 148 r2579 73ae2d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'test-h264-pad.mkv':
  Metadata:
    encoder         : Lavf57.21.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x540 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      DURATION        : 00:01:00.000000000
      encoder         : Lavc57.21.100 libx264
    Side data:
      unknown side data type 10 (24 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 1500 fps=152 q=-1.0 Lsize=    7188kB time=00:00:59.92 bitrate= 982.7kbits/s speed=6.08x    
video:7176kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.157405%
[libx264 @ 0x561e713ee820] frame I:6     Avg QP:12.68  size: 15801
[libx264 @ 0x561e713ee820] frame P:989   Avg QP:23.22  size:  5493
[libx264 @ 0x561e713ee820] frame B:505   Avg QP:28.78  size:  3606
[libx264 @ 0x561e713ee820] consecutive B-frames: 37.7% 49.7%  7.2%  5.3%
[libx264 @ 0x561e713ee820] mb I  I16..4: 74.7% 12.7% 12.6%
[libx264 @ 0x561e713ee820] mb P  I16..4:  1.6%  2.7%  0.2%  P16..4:  9.1%  4.3%  2.6%  0.0%  0.0%    skip:79.4%
[libx264 @ 0x561e713ee820] mb B  I16..4:  0.2%  0.1%  0.1%  B16..8: 14.1%  2.9%  0.8%  direct: 1.9%  skip:79.8%  L0:47.4% L1:46.2% BI: 6.4%
[libx264 @ 0x561e713ee820] 8x8 transform intra:53.1% inter:35.8%
[libx264 @ 0x561e713ee820] coded y,uvDC,uvAC intra: 5.6% 16.3% 14.4% inter: 4.0% 8.6% 7.4%
[libx264 @ 0x561e713ee820] i16 v,h,dc,p: 61% 36%  2%  0%
[libx264 @ 0x561e713ee820] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  3%  9% 86%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x561e713ee820] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 41%  1%  1%  1%  2%  1%  3%
[libx264 @ 0x561e713ee820] i8c dc,h,v,p: 57% 23% 19%  0%
[libx264 @ 0x561e713ee820] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x561e713ee820] ref P L0: 54.2%  7.5% 23.7% 14.6%
[libx264 @ 0x561e713ee820] ref B L0: 76.2% 22.5%  1.3%
[libx264 @ 0x561e713ee820] ref B L1: 97.6%  2.4%
[libx264 @ 0x561e713ee820] kb/s:979.72

The two output files test-h264-pad.mkv and test-mpeg2-pad.mkv looks perfectly fine.

@SarasotaSlim?: so as said before, please provide the requested information since your issue is not reproducible.

comment:6 Changed 3 years ago by SarasotaSlim

For the case of input codec being MPEG2 or 4, you are correct...when I explicitly
add "-vcodec mpeg4', it will use that, and is much faster.

But, WHY does it default output to H264??? (which is 5 times slower).

I'd argue, you should logically do "-vcodec copy", since you do NOT allow
me to say that explicitly.

But, in the case of input vcodec of H264 (and requesting same for the output),
it fails with:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0000026895d2a6c0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 720x316
, 1580 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'In_the_Cut-10mins.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.21.100

Duration: 00:10:00.00, start: 0.016000, bitrate: 1885 kb/s

Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 720x316, 1580 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 320 kb/s (default)
Metadata:

handler_name : SoundHandler?

File 'In_the_Cut-ffmpeg-pad.mp4' already exists. Overwrite ? [y/N] y
[buffer @ 0000026895d2d0e0] Unable to parse option value "-1" as pixel format

Last message repeated 1 times

[buffer @ 0000026895d2d0e0] Error setting option pix_fmt to value -1.

Say what???

Consider increasing the value for the 'analyzeduration' and 'probesize' options ????
Unable to parse option value "-1" as pixel format ???

Now THAT is what "makes no sense at all".

If your code can't reach into the input's metadata, as VLC seems to be doing, it's broken.

(Back when I got those msgs, I tried adding "-pix_fmt yuv420p" but that didn't cut it.)

So, I'm arguing that padding is totally unusable, in the case of H264.

comment:7 Changed 3 years ago by richardpl

Please provide input file you use.

comment:8 Changed 3 years ago by SarasotaSlim

Ok, file is at: http://www.datafilehost.com/d/9879f231

The mediainfo for it is:

Complete name : VIDEO-16by9-3mins.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 38.2 MiB
Duration : 3mn 0s
Overall bit rate : 1 779 Kbps
Writing application : Lavf54.63.104

Video
ID : 1
Format : AVC
Format/Info? : Advanced Video Codec
Format profile : Main@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames? : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3mn 0s
Duration_FirstFrame : 880ms
Bit rate : 1 498 Kbps
Width : 640 pixels
Height : 360 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.260
Stream size : 31.3 MiB (82%)
Writing library : x264 core 129
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x1:0x131 / me=dia / subme=2 / psy=1 / psy_rd=1.00:0
.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threa
ds=4 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / we
ightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1498 / ratetol=1.0 /

qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.41 / aq=1:1.00

Audio
ID : 2
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Codec ID : 6B
Duration : 2mn 59s
Duration_FirstFrame : 48ms
Bit rate mode : Constant
Bit rate : 320 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 6.84 MiB (18%)

comment:9 Changed 3 years ago by SarasotaSlim

Hmmm...so I just tried that file that I pointed you at (it wasn't the same one
that was causing the problem, yet it (should be). This one DOES work.

I meant to send you file named Raising_Arizona-3mins.mkv

However, today when I re-run the pad on Raising_Arizona-3mins.mkv
it DOES work. (And, of course, I have no explanation as to why.)

Sorry for all the trouble. (Sigh.)

We can close this bug-report.

Note: See TracTickets for help on using tickets.