[FFmpeg-user] Fw: Null processed Video file is not the same as original
MohammadH Sedaaghi
sedaaghi at yahoo.com
Thu Nov 1 07:33:39 CET 2012
Sorry to resend the email. I forgot to add the console output.
Dear Carl
I tested your suggestion but as expected, it did’t work. The
parameter –r 25 is not important.
I need to do video processing. For this purpose, I want
first to do null processing. It means that I want to read frame info of a video
file (e.g., orig.mp4) into still images and a
wave file. Then merge them into another video file (say it output.mp4). I expect both files (orig.mp4 and output.mp4)
be the same but they are not and output.mp4 has more frames than orig.mp4. That
is my question. To illustrate the problem, I make three following stages (the
size of orig.mp4 is 284 KB):
Stage 1: Read orig.mp4 into
still images+wav file:
"
del *.jpg
del *.wav
ffmpeg -i orig.mp4 -r 25 Img%d.jpg
Wave.wav
"
It generates 51 .jpg images (Img1.jpg, Img2.jpg, etc.) and 1 .wav file is
generated.
Console output:
ffmpeg version N-45739-g04bf2e7 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 20 2012 00:22:29 with gcc 4.7.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 76.100 / 51. 76.100
libavcodec 54. 67.100 / 54. 67.100
libavformat 54. 33.100 / 54. 33.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.103 / 3. 19.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'orig.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.31.100
Duration: 00:00:02.03, start: 0.033333, bitrate: 1139 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 1018 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 129 kb/s
Metadata:
handler_name : SoundHandler
Output #0, image2, to 'Img%d.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.33.100
Stream #0:0(und): Video: mjpeg, yuvj420p, 720x576 [SAR 1:1 DAR 5:4], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Metadata:
handler_name : VideoHandler
Output #1, wav, to 'Wave.wav':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
ISFT : Lavf54.33.100
Stream #1:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Stream #0:1 -> #1:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
frame= 51 fps=0.0 q=0.0 Lsize= 0kB time=00:00:02.04 bitrate= 0.0kbits/s dup=1 drop=0
video:891kB audio:384kB subtitle:0 global headers:0kB muxing overhead -100.000000%
Stage 2: still images+wav file
into output.mp4:
"
ffmpeg -i Wave.wav -f image2 -i
Img%d.jpg -r 25 output.mp4
"
It produces output.mp4 with a size of 328 KB!, meaning that
it differs from orig.mp4. Why?
To show how it differs, I make the following stage:
The console output:
ffmpeg version N-45739-g04bf2e7 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 20 2012 00:22:29 with gcc 4.7.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 76.100 / 51. 76.100
libavcodec 54. 67.100 / 54. 67.100
libavformat 54. 33.100 / 54. 33.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.103 / 3. 19.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'Wave.wav':
Metadata:
encoder : Lavf54.33.100
Duration: 00:00:02.04, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Input #1, image2, from 'Img%d.jpg':
Duration: 00:00:02.04, start: 0.000000, bitrate: N/A
Stream #1:0: Video: mjpeg, yuvj420p, 720x576 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 00000000006f1ea0] using SAR=1/1
[libx264 @ 00000000006f1ea0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 00000000006f1ea0] profile High, level 3.0
[libx264 @ 00000000006f1ea0] 264 - core 128 r2216 198a7ea - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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, mp4, to 'output.mp4':
Metadata:
encoder : Lavf54.33.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 720x576 [SAR 1:1 DAR 5:4], q=-1--1, 12800 tbn, 25 tbc
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (mjpeg -> libx264)
Stream #0:0 -> #0:1 (pcm_s16le -> libvo_aacenc)
Press [q] to stop, [?] for help
frame= 51 fps= 34 q=-1.0 Lsize= 349kB time=00:00:02.05 bitrate=1387.9kbits/s
video:313kB audio:33kB subtitle:0 global headers:0kB muxing overhead 0.796114%
[libx264 @ 00000000006f1ea0] frame I:1 Avg QP:15.96 size: 5292
[libx264 @ 00000000006f1ea0] frame P:26 Avg QP:24.86 size: 8132
[libx264 @ 00000000006f1ea0] frame B:24 Avg QP:25.55 size: 4295
[libx264 @ 00000000006f1ea0] consecutive B-frames: 17.6% 54.9% 11.8% 15.7%
[libx264 @ 00000000006f1ea0] mb I I16..4: 61.4% 38.5% 0.2%
[libx264 @ 00000000006f1ea0] mb P I16..4: 12.1% 32.2% 2.0% P16..4: 11.0% 3.6% 1.3% 0.0% 0.0% skip:37.7%
[libx264 @ 00000000006f1ea0] mb B I16..4: 4.4% 14.4% 0.1% B16..8: 19.7% 5.4% 1.3% direct: 2.6% skip:52.2% L0:52.5% L1:38.4% BI: 9.1%
[libx264 @ 00000000006f1ea0] 8x8 transform intra:69.5% inter:93.2%
[libx264 @ 00000000006f1ea0] coded y,uvDC,uvAC intra: 50.1% 73.3% 7.3% inter: 9.6% 12.6% 0.6%
[libx264 @ 00000000006f1ea0] i16 v,h,dc,p: 35% 42% 18% 4%
[libx264 @ 00000000006f1ea0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 42% 3% 0% 1% 1% 1% 5%
[libx264 @ 00000000006f1ea0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 76% 5% 0% 0% 0% 0% 0% 0%
[libx264 @ 00000000006f1ea0] i8c dc,h,v,p: 34% 34% 27% 4%
[libx264 @ 00000000006f1ea0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000006f1ea0] ref P L0: 57.7% 13.4% 18.3% 10.6%
[libx264 @ 00000000006f1ea0] ref B L0: 71.9% 25.7% 2.3%
[libx264 @ 00000000006f1ea0] ref B L1: 94.9% 5.1%
[libx264 @ 00000000006f1ea0] kb/s:1254.21
Stage 3: Read output.mp4 into
still images+wav file:
"
del *.jpg
del *.wav
ffmpeg -i output.mp4 -r 25 PImg%d.jpg
PWave.wav
"
it produces 52 .jpg images and 1 bigger .wav file compared
to the first .wav file. Even the information inside images differ (i.e.,
Img1.jpg differs from PImg1.jpg)
The console output:
ffmpeg version N-45739-g04bf2e7 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 20 2012 00:22:29 with gcc 4.7.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 76.100 / 51. 76.100
libavcodec 54. 67.100 / 54. 67.100
libavformat 54. 33.100 / 54. 33.100
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.103 / 3. 19.103
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.33.100
Duration: 00:00:02.08, start: 0.033333, bitrate: 1371 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p, 720x576 [SAR 1:1 DAR 5:4], 1256 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128 kb/s
Metadata:
handler_name : SoundHandler
Output #0, image2, to 'PImg%d.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.33.100
Stream #0:0(und): Video: mjpeg, yuvj420p, 720x576 [SAR 1:1 DAR 5:4], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Metadata:
handler_name : VideoHandler
Output #1, wav, to 'PWave.wav':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
ISFT : Lavf54.33.100
Stream #1:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Stream #0:1 -> #1:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
frame= 52 fps=0.0 q=0.0 Lsize= 0kB time=00:00:02.09 bitrate= 0.0kbits/s dup=1 drop=0
video:845kB audio:392kB subtitle:0 global headers:0kB muxing overhead -100.000000%
I should be confident about null processing at first to be
able to add some processing later.
Could you please give me a hint about why the number of
files should and therefore their contents should be different in every try?
Thanks in advance.
=================================
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
To: ffmpeg-user at ffmpeg.org
Sent: Wednesday, October 31, 2012 7:34 PM
Subject: Re: [FFmpeg-user] -r default value
MohammadH Sedaaghi <sedaaghi <at> yahoo.com> writes:
> 30 .jpg images and 1 .wav file is generated.
> To test the correctness of ffmpeg if in turn we run
> the following command:
> ffmpeg -i Wave.wav -f image2 -i Img%d.jpg -r 30 out.mp4
If you had added complete, uncut console output, you could
see that ffmpeg defaults to "-r 25" for the input since
you did not provide another value.
Please always use a valid subject when mailing.
Carl Eugen
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
More information about the ffmpeg-user
mailing list