[Ffmpeg-devel] -pad parameters

herve.flores herve.flores
Sun Jun 4 13:24:16 CEST 2006


Hi, this is some "bug" report about the pad parameters

1st sorry for my english

2nd, I'm on Mac 10.4.6 on PPC
I have no idea if it's an endian problem,
These errors are reproducable on Mac/PPC (compile from friends with  
svn version)
this pb is not new (I have the same during last year with all cvs  
version)
I don't know with other platforms...

---------------------------------------------
Source(file):

an example of a source (a simple extract of french TV in PAl non- 
square pixel, in yuv420) (432Ko):
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/test_pad.mp4>
(but you can take every source with every chroma or square pixel...  
don't mind)

Results files are avaible after the command lines (during the mail)

---------------------------------------------
the "-padcolor" don't like the "-f image2pipe" (not preserve colors)
command-line and verbose:

Last login: Sun Jun  4 13:14:12 on ttyp2
Welcome to Darwin!
power-mac-g4-de-herve:~ herve$  ffmpeg -v 1 -i ~/test_pad.mp4 -s  
720x436 -padtop 70 -padbottom 70 -padcolor 000000 -r pal -f  
image2pipe -vcodec ppm - | ffmpeg -v 1 -f image2pipe -vcodec ppm -i -  
-y -f rawvideo -vcodec mpeg2video -target dvd -aspect 4:3 -an ~/ 
Desktop/output.m2v
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:  --enable-pthreads --enable-static --disable-shared  
--enable-a52 --enable-x264 --enable-gpl --enable-amr_nb --enable- 
amr_wb --enable-xvid --enable-mp3lame --enable-libogg --enable-libgsm  
--enable-dts --enable-faac --disable-ffplay
   libavutil version: 49.0.0
   libavcodec version: 51.9.0
   libavformat version: 50.4.0
   built on Jun  4 2006 12:57:51, gcc: 4.0.1 (Apple Computer, Inc.  
build 5341)
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:  --enable-pthreads --enable-static --disable-shared  
--enable-a52 --enable-x264 --enable-gpl --enable-amr_nb --enable- 
amr_wb --enable-xvid --enable-mp3lame --enable-libogg --enable-libgsm  
--enable-dts --enable-faac --disable-ffplay
   libavutil version: 49.0.0
   libavcodec version: 51.9.0
   libavformat version: 50.4.0
   built on Jun  4 2006 12:57:51, gcc: 4.0.1 (Apple Computer, Inc.  
build 5341)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/herve/test_pad.mp4':
   Duration: 00:00:07.6, start: 0.000000, bitrate: 460 kb/s
   Stream #0.0(und), 25.00 fps(r): Video: mpeg4, yuv420p, 720x576
   Stream #0.1(und): Audio: mp4a / 0x6134706D, 48000 Hz, stereo
Output #0, image2pipe, to 'pipe:':
   Stream #0.0, 25.00 fps(c): Video: ppm, rgb24, 720x576, q=2-31, 200  
kb/s
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
Input #0, image2pipe, from 'pipe:':ime=1.9 bitrate=248835.0kbits/s
   Duration: N/A, bitrate: N/A
   Stream #0.0, 25.00 fps(r): Video: ppm, rgb24, 720x576
Assuming PAL for target.
Output #0, dvd, to '/Users/herve/Desktop/output.m2v':
   Stream #0.0, 25.00 fps(c): Video: mpeg2video, yuv420p, 720x576,  
q=2-31, 6000 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
frame=  191 q=0.0 Lsize=  232068kB time=7.6 bitrate=248835.0kbits/s
video:232068kB audio:0kB global headers:0kB muxing overhead 0.000000%
frame=  191 q=2.0 Lsize=    1814kB time=7.6 bitrate=1955.3kbits/s
video:1752kB audio:0kB global headers:0kB muxing overhead 3.526752%

PS: with an output to yuv4mpegpipe or a direct encoding (no pipe)  
there is no such pb (black remains black)
the add of -pix_fmt rgb24 with "-f image2pipe" don't change anything  
(the output stream from decoding is still in rgb)

output with "-f image2pipe" (1,8Mo):
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/ 
output_image2pipe.m2v.zip>
a screenshoot of "output_image2pipe.m2v" (60Ko):
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/output_image2pipe.jpg>

---------------------------------------------
parameter "-pad..." cancels parameter "-aspect":

I don't send the verbose (because of the lisibility of the mail, but  
if you want it, I'll send it). There is nothing strange in the  
verbose, but parameter is not in the resulting stream.

(Pre-Scriptum : with a pipe there is no pb : ffmpeg -i [input4:3] -s  
520x576 -padright 100 -padleft 100 -padcolor 000000 -f  yuv4mpegpipe   
- | ffmpeg  -f  yuv4mpegpipe -i - -aspect 16:9 -r pal -vcodec  
mpeg2video [output16:9.m2v])

...but without a pipe (with a direct decoding/encoding):
I explain with an example:
I have a source with aspect 4:3, I contract the source and add black  
lines to do a 16:9 source (like an awfull letterbox on sides of the  
source ;-)) :
ffmpeg -i [input4:3] -s 520x576 -padright 100 -padleft 100 -padcolor  
000000 -aspect 16:9 -r pal -vcodec mpeg2video [output.mpg]

command line:
ffmpeg -v 1 -i ~/test_pad.mp4 -s 520x576 -padright 100 -padleft 100 - 
padcolor 000000 -aspect 16:9 -r pal -vcodec mpeg2video ~/Desktop/ 
output_aspect_padright.m2v

the resulting stream is 720*576px = OK
but the aspect written in the MPEG is nor 4:3 nor 16:9 (there is no  
"bit of information" in the output_aspect.m2v about 16:9, but it's  
not a 4:3 too)
then the preview is nor an anamorphic 16:9 PAL (display in 1024*576),  
nor an anamorphic 4:3 PAL (display in 768*576)
but some "anamorphic 16:9 PAL + black lines" (display in 1272*576px)
(you can take a look to display with VLC for example which use ffmpeg  
to decode the stream, same sort of display with mplayer)

output with "aspect 16:9" and "padright" (400 Ko)
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/ 
output_aspect_padright.m2v.zip>

with a vertical pad (with parameter -aspect 16:9), same problem,  
aspect is not written to target:
ffmpeg -v 1 -i ~/test_pad.mp4 -s 720x376 -padtop 100 -padbottom 100 - 
padcolor 000000 -aspect 16:9 -r pal -vcodec mpeg2video ~/Desktop/ 
output_aspect_padtop.m2v
The resulting aspect is nor 4:3 nor 16:9 (display in real size 720*576)

output with  "aspect 4:3" and "padtop"
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/ 
output_aspect_padtop.m2v.zip>

REM: with the crop parameter aspect seems to be written to target.
ffmpeg -v 1 -i ~/test_pad.mp4 -croptop 10 -cropbottom 10 -s 720x556 - 
aspect 16:9 -r pal -vcodec mpeg2video ~/Desktop/ 
output_aspect_croptop.m2v
->OK, the resulting aspect is 16:9 (display in 16:9 - 1024*576px)


Then with "-pad..." the aspect is not conservate...
I tried to place the aspect parameter everywhere but with the same  
result :-(
(I tried before the input, after, in the middle, after the output, ...)
seems that the pad will always "kill" the specified aspect

Sometimes aspect is automatically well written (it depends of the  
size of the -pad):

with an add of 38 pixels with this source -> aspect preserve
ffmpeg -v 1 -i ~/test_pad.mp4 -s 644x576 -padright 38 -padleft 38 - 
padcolor 000000 -aspect 16:9 -r pal -vcodec mpeg2video -y ~/Desktop/ 
output_aspect_padright_xx.m2v
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/ 
output_aspect_padright_xx.m2v.zip>

with an add of 40 pixels (last pad+2 pixel) with this source ->  
aspect not preserve
ffmpeg -v 1 -i ~/test_pad.mp4 -s 640x576 -padright 40 -padleft 40 - 
padcolor 000000 -aspect 16:9 -r pal -vcodec mpeg2video -y ~/Desktop/ 
output_aspect_padright_xx'+'2.m2v
<http://herve.flores.online.fr/_PRIVATE/ffmpeg/ 
output_aspect_padright_xx+2.m2v.zip>

Stange isn't it ?!?
The last strange thing is that with (-s 644x576 -padright 38 -padleft  
38) or (-s 520x576 -padright 100 -padleft 100) the resulting display  
size is the same:
- real size        : 720*576
- display size : 1272*576px
I don't manage to find an explanation (% of pixels add with the size  
of the source or something else...)
...maybe some control of "aspect ratio" in the code? (I don't know in  
fact and don't have skills to understand the code ;-))

---------------------------------------------

bye
ffmpeg is a great tool !
thanks :-)

Herv?

???`???,??,???`???,??,???`???,??,???`???,??,???`???
ALLEZ FAIRE UN TOUR SUR http://herve.flores.online.fr
Illustrateur~graphiste
???`???,??,???`???,??,???`???,??,???`???,??,???`???








More information about the ffmpeg-devel mailing list