[FFmpeg-user] Remuxing RTMP to TS

lyncher at sapo.pt lyncher at sapo.pt
Mon Dec 16 14:58:23 CET 2013

Hello all,
I'm trying to save a RTMP live FLV stream (Video: AVC Main at L3.1, 
488Kbps, 25fps, Audio: AAC-LC, 44.1KHz, stereo) to a file using MPEGTS 
When I save the file directly to FLV, there's no issues with the 
recorded file.

ffmpeg -i "rtmp://rtmpserver/app/stream"  -vcodec copy -acodec copy live.flv
ffmpeg version N-58949-g0e575c2 Copyright (c) 2000-2013 the FFmpeg 
   built on Dec  9 2013 22:06:49 with gcc 4.8.2 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads 
isynth --enable-bzlib --enable-fontconfig --enable-frei0r 
--enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca 
e --enable-libgsm --enable-libilbc --enable-libmodplug 
--enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg 
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr 
eex --enable-libtheora --enable-libtwolame --enable-libvidstab 
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx 
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
Output #0, flv, to 'file.flv':
     author          :
     copyright       :
     description     :
     keywords        :
     rating          :
     title           :
     presetname      : Custom
     creationdate    : Sun Dec 15 20:57:51 2013
     videodevice     :
     avclevel        : 31
     avcprofile      : 66
     videokeyframe_frequency: 5
     audiodevice     :
     audiochannels   : 2
     audioinputvolume: 75
     frameWidth      : 640
     frameHeight     : 360
     displayWidth    : 640
     displayHeight   : 360
     encoder         : Lavf55.22.100
     Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 640x360 
[SAR 1:1DAR 16:9], q=2-31, 499 kb/s, 1k tbn, 1k tbc
     Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, 
49 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help

The problem is when I try to remux FLV to MPEGTS with:

ffmpeg -i "rtmp://rtmpserver/app/stream" -vbsf h264_mp4toannexb -vcodec 
copy -acodec copy -copyts -copytb 0 -vsync drop -y -f mpegts file.ts
Output #0, mpegts, to '95.ts':
     Stream #0:0: Video: h264, yuv420p, 640x360 [SAR 1:1 DAR 16:9], 
q=2-31, 499 kb/s, 90k tbn, 25 tbc
     Stream #0:1: Audio: aac, 44100 Hz, stereo, 49 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 00000000026ff020] Encoder did not produce proper pts, making 
some up.

The TS file is written but audio is not synchronized with video.
I tried several flags (copyts, vsync.....) but didn't found any 
combination that allows to remux the FLV->TS keeping audio and video in 
What I'm doing wrong?

Thanks in advance for any suggestion.


More information about the ffmpeg-user mailing list