[FFmpeg-user] moving from FLV to MP4 container
Victor C
c-map at hotmail.com
Thu Aug 16 02:01:41 CEST 2012
Hi,
I have an FLV file which plays correctly. When I put it in an MP4 container using:
ffmpeg -i video.flv -acodec copy -vcodec copy video.mp4
video.mp4 does not play properly in Media Player Classic Homecinema 1.3.1264.0 (MPC). When I double-click a video file in Windows Explorer it usually begins playing automatically in MPC; this file does not. If I click on the "seek bar" to jump to different parts of the video, it plays, but the audio and video are out of sync. A large part of the video is missing from the beginning: I can hear the audio from the beginning of the original file playing while I see video from several minutes into the original file. No video seems to play at the end of the file.
When I stop playback by clicking the 'stop' button and then restart playback by clicking the 'play' button, the video plays at about double the correct frame rate.
Does anyone know how to make this conversion properly? I've noticed the following oddities in the properties of the FLV and the generated MP4, in case it helps:
When I use ffmpeg -i video.(flv | mp4), the tbr and tbc values of the video stream are the same in both files, but the tbn is 1k in the FLV and 10000k in the MP4. Why are they different?
There is an fps value listed for the video stream in the MP4 but not in the FLV.
Why does ffmpeg say below that it is estimating the FLV duration from the bitrate? Should the FLV explicitly state the duration?
In the output below which shows the properties of the MP4, why is the fraction used to approximate the container frame rate of 23.98 different from the one in the properties of the FLV (20,000,000/834166 vs. 24000/1001)?
Why are the bitrates of the streams lower in the MP4, given that they were copied from the FLV?
Why don't the duration and start values match?
These are the properties of the original file:
C:\Users\admin\Documents\videos>ffmpeg -i video.flv
FFmpeg version git-N-29181-ga304071, Copyright (c) 2000-2011 the FFmpeg develope
rs
built on Apr 18 2011 21:24:03 with gcc 4.5.2
configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
ble-memalign-hack --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --cross-prefix=i686-w6
4-mingw32- --target-os=mingw32 --arch=x86_32 --extra-cflags=-I/home/kyle/softwar
e/ffmpeg/external-libraries/win32/include --extra-ldflags=-L/home/kyle/software/
ffmpeg/external-libraries/win32/lib --pkg-config=pkg-config
libavutil 50. 40. 1 / 50. 40. 1
libavcodec 52.120. 0 / 52.120. 0
libavformat 52.108. 0 / 52.108. 0
libavdevice 52. 4. 0 / 52. 4. 0
libavfilter 1. 79. 0 / 1. 79. 0
libswscale 0. 13. 0 / 0. 13. 0
[flv @ 01C2B810] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (200000
00/417083) -> 23.98 (24000/1001)
Input #0, flv, from 'video.flv':
Metadata:
hasKeyframes : true
audiodatarate : 81
hasVideo : true
stereo : true
canSeekToEnd : false
framerate : 23
audiosamplerate : 44000
videocodecid : 7
datasize : 116897793
lasttimestamp : 2800
audiosamplesize : 16
audiosize : 29553706
hasAudio : true
audiodelay : 0
videosize : 87332165
metadatacreator : inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/fl
vtool2
lastkeyframetimestamp: 2798
height : 480
filesize : 117648602
hasMetadata : true
audiocodecid : 10
videodatarate : 247
duration : 2800
hasCuePoints : false
width : 640
Duration: 00:46:39.67, start: 0.042000, bitrate: 335 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 253 kb/
s, 23.98 tbr, 1k tbn, 47.95 tbc
Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 82 kb/s
At least one output file must be specified
The MP4 produced using ffmpeg -i video.flv -acodec copy -vcodec copy video.mp4 has these properties:
ffmpeg -i video.mp4
FFmpeg version git-N-29181-ga304071, Copyright (c) 2000-2011 the FFmpeg develope
rs
built on Apr 18 2011 21:24:03 with gcc 4.5.2
configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
ble-memalign-hack --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --cross-prefix=i686-w6
4-mingw32- --target-os=mingw32 --arch=x86_32 --extra-cflags=-I/home/kyle/softwar
e/ffmpeg/external-libraries/win32/include --extra-ldflags=-L/home/kyle/software/
ffmpeg/external-libraries/win32/lib --pkg-config=pkg-config
libavutil 50. 40. 1 / 50. 40. 1
libavcodec 52.120. 0 / 52.120. 0
libavformat 52.108. 0 / 52.108. 0
libavdevice 52. 4. 0 / 52. 4. 0
libavfilter 1. 79. 0 / 1. 79. 0
libswscale 0. 13. 0 / 0. 13. 0
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (200000
00/417083) -> 23.98 (20000000/834166)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.108.0
Duration: 00:46:39.66, start: 0.000000, bitrate: 335 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 24
6 kb/s, 23.98 fps, 23.98 tbr, 10000k tbn, 47.95 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 79 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
At least one output file must be specified
Thanks,
Victor
More information about the ffmpeg-user
mailing list