[FFmpeg-user] DVB H264 chunk transcoding => merging in MP4 => out of sync

ffmpeg at me.com ffmpeg at me.com
Wed Mar 15 14:03:12 EET 2017


Viewing on VLC works great. Audio/Video perfectly in sync. Viewing in Quicktime (Version 10.4 MacOS sierra, Quicktime 7) the video get's out of sync after 3/4 minutes. Scrubbing in the timeline will fix the problem, then after 3/4 minutes I see the synchronization problem again.

Using current FFmpeg version to transcode into H.264 and AAC TS chunks. 

ffmpeg -i "udp://224.5.2.5:10001?overrun_nonfatal=1&fifo_size=50000000" -map 0:3 -map 0:4 -s 1280x720 -acodec aac -b:a 192k -ac 2 -ar 48000 -vcodec libx264 -preset:v medium -r 50 -g 100 -vb 3200000 -y -fflags +genpts -f segment -segment_time 60 -segment_atclocktime 1 -strftime 1 "/videofiles/TV_HD_%Y-%m-%d_%H-%M-%S.ts

Everything works fine... chunks are created. No errors in output. Audio/video TS pieces in sync.

#### Details of a chunk file: 

ffprobe /videofiles/TV_HD_2017-03-13_14-25-00.ts
ffprobe version 3.2.4-tessus Copyright (c) 2007-2017 the FFmpeg developers
 built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
 configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
 libavutil      55. 34.101 / 55. 34.101
 libavcodec     57. 64.101 / 57. 64.101
 libavformat    57. 56.101 / 57. 56.101
 libavdevice    57.  1.100 / 57.  1.100
 libavfilter     6. 65.100 /  6. 65.100
 libswscale      4.  2.100 /  4.  2.100
 libswresample   2.  3.100 /  2.  3.100
 libpostproc    54.  1.100 / 54.  1.100
Input #0, mpegts, from '/Users/Andreas/Desktop/TEST/ARD_HD_2017-03-13_14-25-00.ts':
 Duration: 00:01:00.04, start: 115.402667, bitrate: 3720 kb/s
 Program 1 
   Metadata:
     service_name    : Service01
     service_provider: FFmpeg
   Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
   Stream #0:1[0x101](deu): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 204 kb/s


#### Merging together: 

ffmpeg -f concat -safe 0 -i files.txt -y -metadata creation_time=now -c:v copy -c:a copy -fflags +genpts -movflags faststart -use_editlist 0 -f mp4 tvexport.mp4

#### and output: 
ffmpeg version 3.2.4-tessus Copyright (c) 2000-2017 the FFmpeg developers
 built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
 configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
 libavutil      55. 34.101 / 55. 34.101
 libavcodec     57. 64.101 / 57. 64.101
 libavformat    57. 56.101 / 57. 56.101
 libavdevice    57.  1.100 / 57.  1.100
 libavfilter     6. 65.100 /  6. 65.100
 libswscale      4.  2.100 /  4.  2.100
 libswresample   2.  3.100 /  2.  3.100
 libpostproc    54.  1.100 / 54.  1.100
Input #0, concat, from 'files.txt':
 Duration: N/A, start: 0.000000, bitrate: N/A
   Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
   Stream #0:1(deu): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 169 kb/s
Output #0, mp4, to 'work_tmp0.mp4':
 Metadata:
   creation_time   : now
   encoder         : Lavf57.56.101
   Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 90k tbn, 90k tbc
   Stream #0:1(deu): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 169 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7fff37800600] Starting second pass: moving the moov atom to the beginning of the filex    
frame=24000 fps=9825 q=-1.0 Lsize=  199633kB time=00:08:00.20 bitrate=3405.6kbits/s speed= 197x    
video:187817kB audio:11755kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030912%


What could be the problem?



More information about the ffmpeg-user mailing list