[FFmpeg-user] Extra, unwanted frames at beginning when converting mpeg2 -> h.264
Scott Roy
sroy8 at yahoo.com
Sat Apr 25 22:48:41 CEST 2015
I have a sequence of video files that I captured from my video camera using iMovie, so the output is a series of .mov files, one for each scene that iMovie detects. The video is in mpeg2 format. I’m trying to convert each file to h.264 in an mp4 container using the very simple:
ffmpeg -i scene.mov scene.mp4
This works without any errors, but I end up with at least one extra frame at the start of each scene which is the last frame from the previous scene.
The original .mov files clearly contain these unwanted frames, but they do not show up when watching the video because the start time of the video is different than 0. For example, when I run ffprobe on one of the files I get:
~/Desktop$ ffprobe scene.mov
ffprobe version 2.6.2 Copyright (c) 2007-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'scene.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-04-13 02:13:48
Duration: 00:02:23.01, start: 0.234083, bitrate: 28184 kb/s
Stream #0:0(und): Video: mpeg2video (Main) (hdv2 / 0x32766468), yuv420p(tv, bt709), 1440x1080 [SAR 4:3 DAR 16:9], 25002 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2015-04-13 02:13:48
handler_name : Core Media Data Handler
encoder : HDV 1080i60
timecode : 00:46:34;09
Stream #0:1(und): Audio: pcm_f32le (fl32 / 0x32336C66), 48000 Hz, stereo, flt, 3072 kb/s (default)
Metadata:
creation_time : 2015-04-13 02:13:48
handler_name : Core Media Data Handler
Stream #0:2(und): Data: none (tmcd / 0x64636D74)
Metadata:
creation_time : 2015-04-13 02:13:48
handler_name : Core Media Data Handler
timecode : 00:46:34;09
Unsupported codec with id 0 for input stream 2
Notice that the start time of the input is 0.234083. Presumably this skips over the unwanted frames at the beginning.
I can get the correct output I want by using:
ffmpeg -ss 0.234083 -i scene.mov scene.mp4
However, this requires knowing the start time for each file, and although I can do this without too much trouble in an awk script, I feel I must be missing something. It seems like a clear error to me that the transcoded output does not faithfully reproduce the frames that will be displayed to the user in the input stream.
Are there flags I should be using to get the correct behavior? I’ve played with various options but haven’t found anything that works.
Thanks,
Scott
More information about the ffmpeg-user
mailing list