video - FFMPEG Cutting Commercials puts audio out of sync -


ubuntu 14.04.1 real ffmpeg loaded (same problem avconv version).

i'm trying take files created in mythtv hdpvr, cut commercials , put video mp4 container use mythroku.

the command

ffmpeg -i $file -acodec copy -vcodec copy -f mp4 file.mp4

works fine. once update database, can watch file in mythroku or plex.

however, when try cut out commercials, audio gets out of sync on 1 second (audio delayed) whenever cut past 0 mark. totem video player , vlc both play resulting video fine, can see "hitch" @ beginning while syncing audio, know information on audio sync in file somewhere. mythroku , plex both out of sync when playing file. mythtv frontend player play correctly, , can hear "hitch" syncs audio.

after hours of reading posts , playing settings, i've got down this:

if say:

ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 0 -t <anything> out.mp4

the file fine, plays both locally , in mythroku/plex

but if advance start amount - 1 second - audio out of sync

ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 1 -t <anything> out.mp4

i've tried splitting video (as mp4) , audio (as ac3) first, splitting them separately, , putting them last step, same results.

the information in file - totem, vlc , frontend can figure out. how can ffmpeg figure out sync , write file it's correct?

original file:

mythtv@marvin:~$ mediainfo /var/lib/mythtv/recordings/2225_20140824001500.mpg general id                                       : 0 (0x0) complete name                            :     /var/lib/mythtv/recordings/2225_20140824001500.mpg format                                   : mpeg-ts file size                                : 4.03 gib duration                                 : 1h 45mn overall bit rate mode                    : variable overall bit rate                         : 5 491 kbps  video id                                       : 4113 (0x1011) menu id                                  : 1 (0x1) format                                   : avc format/info                              : advanced video codec format profile                           : main@l4.0 format settings, cabac                   : yes format settings, reframes                : 4 frames format settings, gop                     : m=4, n=32 codec id                                 : 27 duration                                 : 1h 45mn bit rate mode                            : variable bit rate                                 : 4 831 kbps maximum bit rate                         : 20.0 mbps width                                    : 1 280 pixels height                                   : 720 pixels display aspect ratio                     : 16:9 frame rate                               : 59.940 fps color space                              : yuv chroma subsampling                       : 4:2:0 bit depth                                : 8 bits scan type                                : progressive bits/(pixel*frame)                       : 0.087 stream size                              : 3.55 gib (88%) color primaries                          : bt.709 transfer characteristics                 : bt.709 matrix coefficients                      : bt.709  audio id                                       : 4352 (0x1100) menu id                                  : 1 (0x1) format                                   : ac-3 format/info                              : audio coding 3 mode extension                           : cm (complete main) format settings, endianness              : big codec id                                 : 129 duration                                 : 1h 45mn bit rate mode                            : constant bit rate                                 : 384 kbps channel(s)                               : 2 channels channel positions                        : front: l r sampling rate                            : 48.0 khz bit depth                                : 16 bits compression mode                         : lossy delay relative video                  : -6ms stream size                              : 289 mib (7%) 

file cut 0:

mythtv@marvin:~$ mediainfo 2225_20140824001500_1.mp4 general complete name                            : 2225_20140824001500_1.mp4 format                                   : mpeg-4 format profile                           : base media codec id                                 : isom file size                                : 58.5 mib duration                                 : 1mn 45s overall bit rate mode                    : variable overall bit rate                         : 4 676 kbps writing application                      : lavf54.63.104  video id                                       : 1 format                                   : avc format/info                              : advanced video codec format profile                           : main@l4.0 format settings, cabac                   : yes format settings, reframes                : 4 frames format settings, gop                     : m=4, n=32 codec id                                 : avc1 codec id/info                            : advanced video coding duration                                 : 1mn 45s bit rate mode                            : variable bit rate                                 : 4 281 kbps maximum bit rate                         : 20.0 mbps width                                    : 1 280 pixels height                                   : 720 pixels display aspect ratio                     : 16:9 frame rate mode                          : variable frame rate                               : 59.940 fps minimum frame rate                       : 59.920 fps maximum frame rate                       : 59.960 fps color space                              : yuv chroma subsampling                       : 4:2:0 bit depth                                : 8 bits scan type                                : progressive bits/(pixel*frame)                       : 0.077 stream size                              : 53.6 mib (92%) color primaries                          : bt.709 transfer characteristics                 : bt.709 matrix coefficients                      : bt.709  audio id                                       : 2 format                                   : ac-3 format/info                              : audio coding 3 mode extension                           : cm (complete main) format settings, endianness              : big codec id                                 : ac-3 duration                                 : 1mn 45s bit rate mode                            : constant bit rate                                 : 384 kbps channel(s)                               : 2 channels channel positions                        : front: l r sampling rate                            : 48.0 khz bit depth                                : 16 bits compression mode                         : lossy stream size                              : 4.81 mib (8%) 

file cut 1 second audio sync problem:

mythtv@marvin:~$ mediainfo 2225_20140824001500_2.mp4 general complete name                            : 2225_20140824001500_2.mp4 format                                   : mpeg-4 format profile                           : base media codec id                                 : isom file size                                : 68.0 mib duration                                 : 2mn 0s overall bit rate mode                    : variable overall bit rate                         : 4 750 kbps writing application                      : lavf54.63.104  video id                                       : 1 format                                   : avc format/info                              : advanced video codec format profile                           : main@l4.0 format settings, cabac                   : yes format settings, reframes                : 4 frames format settings, gop                     : m=4, n=32 codec id                                 : avc1 codec id/info                            : advanced video coding duration                                 : 1mn 58s bit rate mode                            : variable bit rate                                 : 4 394 kbps maximum bit rate                         : 20.0 mbps width                                    : 1 280 pixels height                                   : 720 pixels display aspect ratio                     : 16:9 frame rate mode                          : variable frame rate                               : 59.940 fps minimum frame rate                       : 59.920 fps maximum frame rate                       : 59.960 fps color space                              : yuv chroma subsampling                       : 4:2:0 bit depth                                : 8 bits scan type                                : progressive bits/(pixel*frame)                       : 0.080 stream size                              : 62.3 mib (92%) color primaries                          : bt.709 transfer characteristics                 : bt.709 matrix coefficients                      : bt.709  audio id                                       : 2 format                                   : ac-3 format/info                              : audio coding 3 mode extension                           : cm (complete main) format settings, endianness              : big codec id                                 : ac-3 duration                                 : 2mn 0s bit rate mode                            : constant bit rate                                 : 384 kbps channel(s)                               : 2 channels channel positions                        : front: l r sampling rate                            : 48.0 khz bit depth                                : 16 bits compression mode                         : lossy stream size                              : 5.49 mib (8%) 


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -