[FFmpeg-user] Problem converting from FLV to MP4

Fernando Martinelli fernando.martinelli at gmail.com
Mon Jul 23 02:52:51 CEST 2012


2012/7/22 Carl Eugen Hoyos <cehoyos at ag.or.at>

> Fernando Martinelli <fernando.martinelli <at> gmail.com> writes:
>
> > I have as inputs:
> >
> >    - Video 1 FLV + Audio 1
> >    - Video 2 FLV + Audio 2
> >
> > The output I want:
> >
> >    - Video 1 MP4 + Audio 1 + Audio 2
> >    - Video 2 MP4 + Audio 1 + Audio 2
>
> I believe this works with FFmpeg, consider reading about Audio
> Filters on http://ffmpeg.org/ffmpeg.html
>
>
I did, but did not manage to apply it.. But this is not the main issue, as
I can do the processing with multiple steps.. The problem is the async
between audio and video.


> [...]
>
> > sorry but I can't paste the entire output as it is huuuge -
> > it has a lot of lines like this *invalid dropping
> > st:0** DTS 8520, next:10374000*...
>
> Then cut those beginning from ~ the fifth line until a few
> lines before end of transcoding.
>

I tested the code below with and without the fps parameter (-r 24, which I
need in the output files). Without it the length of the mp4 video remains
almost exactly the same as the flv input. However (see below), with the -r
parameter the output video is much longer although the audio stays the same
(causing the asynchronicity).

*Here is the command and the output:*

ffmpeg -i  input.flv -vcodec mpeg4 -b:v 200k -r 24 -vf scale=320:240 -ar
44100 -y output.mp4
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 12 2012 15:00:45 with gcc 4.7.1
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security '
--extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared
--enable-libmp3lame --enable-gpl --enable-nonfree
--disable-decoder=libdirac --enable-libvorbis --disable-pthreads
--enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab
--enable-libgsm --enable-libtheora --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libx264 --enable-libspeex
--enable-nonfree --disable-stripping --enable-libschroedinger
--disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg
--enable-libvpx --enable-librtmp --enable-avfilter --enable-libfreetype
--enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc
--enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda
--enable-libbluray --enable-libdc1394 --disable-altivec --disable-armv5te
--disable-armv6 --disable-vis --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[libspeex @ 0xc22b80] Missing Speex header, assuming defaults.
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, flv, from ' input .flv':
  Metadata:
    creationdate    : Sat Jul 21 12:20:45
  Duration: 00:11:25.61, start: 0.000000, bitrate: 211 kb/s
    Stream #0:0: Video: h264 (Baseline), yuv420p, 320x240 [SAR 1:1 DAR
4:3], 12 tbr, 1k tbn, 24 tbc
    Stream #0:1: Audio: speex, 16000 Hz, mono, s16
[buffer @ 0xc23160] w:320 h:240 pixfmt:yuv420p tb:1/1000 sar:1/1
sws_param:flags=2
[buffersink @ 0xca0cc0] No opaque field provided
[scale @ 0xc30ee0] w:320 h:240 fmt:yuv420p sar:1/1 -> w:320 h:240
fmt:yuv420p sar:1/1 flags:0x4
[aformat @ 0xc32180] auto-inserting filter 'auto-inserted resampler 0'
between the filter 'src' and the filter 'aformat'
[aresample @ 0xc1d6c0] chl:mono fmt:s16 r:16000Hz -> chl:mono fmt:s16
r:44100Hz
[libspeex @ 0xc22b80] Missing Speex header, assuming defaults.
Output #0, mp4, to 'output.mp4':
  Metadata:
    creationdate    : Sat Jul 21 12:20:45
    encoder         : Lavf54.6.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 320x240 [SAR
1:1 DAR 4:3], q=2-31, 200 kb/s, 24 tbn, 24 tbc
    Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 44100 Hz, mono, s16, 128
kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (libspeex -> libfaac)
Press [q] to stop, [?] for help
DTS 2068, next:2151333 st:0 invalid dropping
PTS 2068, next:2151333 invalid dropping st:0
[... many lines like that]
frame=16965 fps=487 q=6.1 Lsize=   24311kB time=00:11:25.63 bitrate=
290.5kbits/s dup=8762 drop=0
video:17580kB audio:6327kB global headers:0kB muxing overhead 1.692541%

*Then when I run only ffmpeg -i output.mp4:*

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf54.6.100
  Duration: 00:11:46.87, start: 0.000000, bitrate: 281 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p, 320x240 [SAR 1:1 DAR 4:3], 203 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, s16,
75 kb/s
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified



>
> Please do not top-post here, Carl Eugen
>

Sorry, I'm new here and still have a lot to learn =) Thanks a lot again
Carl!


>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
Regards/ viele Grüße,
Fernando


More information about the ffmpeg-user mailing list