[FFmpeg-user] Duplicate frame when use seek option.
César Sepúlveda
csepulveda at mediastre.am
Tue Sep 23 15:40:14 CEST 2014
Hello guys, i wrote this because we have problems when we want to cut a mp4
video.
The description of video below:
imac-de-cesar:~ csepulveda$ ffprobe -i gop_10.mp4 -show_streams
-select_streams v:0 -print_format json
ffprobe version 2.3.3-tessus Copyright (c) 2007-2014 the FFmpeg developers
built on Aug 19 2014 20:44:45 with clang version 3.3
(tags/RELEASE_33/final)
configuration: --cc=/opt/local/bin/clang-mp-3.3
--prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus
--disable-shared --enable-static --disable-ffplay --enable-gpl
--enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid
--enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libxavs --enable-version3
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx
--enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig
--enable-libfreetype --enable-libass --enable-libbluray --enable-filters
--disable-indev=qtkit --enable-runtime-cpudetect
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
{
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gop_10.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.48.100
Duration: 00:05:00.44, start: 0.023220, bitrate: 3359 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3225 kb/s, 29.97 fps,
29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Constrained Baseline",
"codec_type": "video",
"codec_time_base": "1001/60000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1280,
"height": 720,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 31,
"r_frame_rate": "30000/1001",
"avg_frame_rate": "30000/1001",
"time_base": "1/30000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 9009000,
"duration": "300.300000",
"bit_rate": "3225657",
"nb_frames": "9000",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"language": "und",
"handler_name": "VideoHandler"
}
}
]
}
we want to cut, for example, from second 5 to second 7. for do this we use
ffprobe to seek the most accurate value for second 5:
imac-de-cesar:~ csepulveda$ ffprobe -i gop_10.mp4 -read_intervals
00:00:05%00:00:06 -show_frames -select_streams v:0 -print_format json
....
{
"media_type": "video",
"key_frame": 0,
"pkt_pts": 150150,
"pkt_pts_time": "5.005000",
"pkt_dts": 150150,
"pkt_dts_time": "5.005000",
"best_effort_timestamp": 150150,
"best_effort_timestamp_time": "5.005000",
"pkt_duration": 1001,
"pkt_duration_time": "0.033367",
"pkt_pos": "2374169",
"pkt_size": "12089",
"width": 1280,
"height": 720,
"pix_fmt": "yuv420p",
"sample_aspect_ratio": "1:1",
"pict_type": "P",
"coded_picture_number": 150,
"display_picture_number": 0,
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0
},
....
we cut from second 5.00500 up to 60 frames.
imac-de-cesar:~ csepulveda$ ffmpeg -y -i gop_10.mp4 -acodec aac -strict -2
-vcodec libx264 -ss 5.00500 -vframes 60 -level 31 -profile:v baseline 1.mp4
ffmpeg version 2.3.3-tessus Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 19 2014 20:44:45 with clang version 3.3
(tags/RELEASE_33/final)
configuration: --cc=/opt/local/bin/clang-mp-3.3
--prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus
--disable-shared --enable-static --disable-ffplay --enable-gpl
--enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid
--enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libxavs --enable-version3
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx
--enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig
--enable-libfreetype --enable-libass --enable-libbluray --enable-filters
--disable-indev=qtkit --enable-runtime-cpudetect
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gop_10.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.48.100
Duration: 00:05:00.44, start: 0.023220, bitrate: 3359 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3225 kb/s, 29.97 fps,
29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 @ 0x7fe878821c00] using SAR=1/1
[libx264 @ 0x7fe878821c00] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0x7fe878821c00] profile Constrained Baseline, level 3.1
[libx264 @ 0x7fe878821c00] 264 - core 142 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0
ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 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=0 weightp=0 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 '1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.48.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97
tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc55.69.100 libx264
Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc55.69.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 60 fps= 40 q=-1.0 Lsize= 776kB time=00:00:02.08
bitrate=3042.2kbits/s dup=1 drop=0
video:740kB audio:33kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.381471%
[libx264 @ 0x7fe878821c00] frame I:1 Avg QP:24.95 size: 65901
[libx264 @ 0x7fe878821c00] frame P:59 Avg QP:25.78 size: 11717
[libx264 @ 0x7fe878821c00] mb I I16..4: 20.5% 0.0% 79.5%
[libx264 @ 0x7fe878821c00] mb P I16..4: 3.6% 0.0% 4.1% P16..4: 45.5%
12.6% 2.5% 0.0% 0.0% skip:31.7%
[libx264 @ 0x7fe878821c00] coded y,uvDC,uvAC intra: 49.9% 80.6% 28.3%
inter: 8.4% 20.5% 0.6%
[libx264 @ 0x7fe878821c00] i16 v,h,dc,p: 32% 30% 13% 25%
[libx264 @ 0x7fe878821c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 20% 15% 5%
5% 7% 5% 6% 4%
[libx264 @ 0x7fe878821c00] i8c dc,h,v,p: 47% 21% 22% 10%
[libx264 @ 0x7fe878821c00] ref P L0: 91.5% 5.9% 2.6%
[libx264 @ 0x7fe878821c00] kb/s:3025.73
all seems fine but this video show twice frame 0 on second 5.
(we burn timestamp before in original video and this show only one frame 0
on second 5)
someone else can reproduce this? it's a bug?
Original video: https://copy.com/3Iu2LtAvvj2s
Result video: https://copy.com/61DYWYJUqUUs
Thanks!.
--
César Sepúlveda
Jefe de Plataforma
Mediastream Chile
Email: csepulveda at mediastre.am
Teléfono: +56 2 24029750
More information about the ffmpeg-user
mailing list