VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date: Oct 2010
    Location: Brazil
    Search PM
    Hey everyone

    I'm encoding a x264+AAC but it has an A/V sync problem:
    Code:
    ffmpeg -i AudioFile_80.ac3 -ac 2 -vn tmp.wav
    faac tmp.wav -o audio.mp4
     
    
    x264 --bitrate 1000 -o video.mp4 VideoFile.m2v
    **or**
    ffmpeg -y -i VideoFile.m2v -vcodec libx264 -b:v 1000k -an video.mp4
    
    
    ffmpeg -i video.mp4 -i audio.mp4 -acodec copy -vcodec copy final.mp4
    The final mp4 has a seeking A/V synchronism problem when using x264 to encode video.
    I prefer x264 over ffmpeg because it produces a smaller filesize with the same quality.
    ffmpeg, generates a bigger file but no A/V sync problem.

    What am i doing wrong?
    thanks
    Quote Quote  
  2. Member bat999's Avatar
    Join Date: Feb 2008
    Location: United Kingdom
    Search Comp PM
    Hi
    What is the result like if you do the job in just one operation?
    Like this:-
    Code:
    ffmpeg -i VideoFile.m2v -c:v libx264 -crf 23 -preset medium -i AudioFile_80.ac3 -c:a aac -strict experimental -b:a 128k -ar 44100 -ac 2 final.mp4
    Last edited by bat999; 9th Jul 2012 at 21:26.
    Quote Quote  
  3. Member
    Join Date: Oct 2010
    Location: Brazil
    Search PM
    it works, but hte problem is:

    I prefer x264 ENCODER (NOT FFMPEG) over ffmpeg because it produces a smaller filesize with the same quality.
    ffmpeg, generates a bigger file but no A/V sync problem.
    Quote Quote  
  4. vanished El Heggunte's Avatar
    Join Date: Jun 2009
    Location: Misplaced Childhood
    Search Comp PM
    Maybe your "VideoFile.m2v" has pulldown flags, OR it's a mixture of progressive and telecined sequences, and x264 is not dealing with that correctly

    Try the switches --force-cfr and --demuxer ffms

    EDIT ---

    Even better, why not use DGindex and DGdecode
    Last edited by El Heggunte; 9th Jul 2012 at 18:42.
    Quote Quote  
  5. Member
    Join Date: Oct 2010
    Location: Brazil
    Search PM
    Maybe your "VideoFile.m2v" has pulldown flags, OR it's a mixture of progressive and telecined sequences, and x264 is not dealing with that correctly

    Try the switches --force-cfr and --demuxer ffms
    I tried all you said and it still A/V sync bugged...
    Actually this m2v file comes from demuxing of ifo/vob with pgcdemux
    What bugs me is that ffmpeg encoding won't result on A/V sync (seeking) problem and x264 does!

    ffmpeg -i video.mp4 -i audio.mp4 -acodec copy -vcodec copy final.mp4:
    Code:
    video:157099kB audio:19665kB global headers:0kB muxing overhead 0.541414%
    Code:
    General
    Complete name                            : VideoFile.m2v
    Format                                   : MPEG Video
    Format version                           : Version 2
    File size                                : 953 MiB
    Duration                                 : 18mn 5s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 7 365 Kbps
    
    Video
    Format                                   : MPEG Video
    Format version                           : Version 2
    Format profile                           : Main@Main
    Format settings, BVOP                    : Yes
    Format settings, Matrix                  : Custom
    Format settings, GOP                     : M=3, N=12
    Duration                                 : 18mn 5s (WRONG!)
     Bit rate mode                            : Variable
    Bit rate                                 : 7 365 Kbps
    Maximum bit rate                         : 9 800 Kbps
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 23.976 fps
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Scan order                               : 2:3 Pulldown
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.889
    Stream size                              : 953 MiB (100%)
    Color primaries                          : SMPTE 170M
    Transfer characteristics                 : SMPTE 170M
    Matrix coefficients                      : SMPTE 170M
    encoded with x264
    Code:
    General
    Complete name                            : video.mp4
    Format                                   : MPEG-4
    Format profile                           : JVT
    Codec ID                                 : avc1
    File size                                : 154 MiB
    Duration                                 : 21mn 41s
    Overall bit rate                         : 991 Kbps
    Encoded date                             : UTC 2012-07-09 22:54:38
    Tagged date                              : UTC 2012-07-09 22:54:38
    
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L3.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 21mn 41s
    Bit rate                                 : 1 000 Kbps
    Maximum bit rate                         : 5 520 Kbps
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Original display aspect ratio            : 4:3
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Standard                                 : NTSC
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.116
    Stream size                              : 153 MiB (100%)
    Writing library                          : x264 core 125 r2200 999b753
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    Encoded date                             : UTC 2012-07-09 22:54:38
    Tagged date                              : UTC 2012-07-09 23:06:28
    Quote Quote  
  6. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    the mpeg2 file is 23.976 fps with pulldown, but you encoded at 25 fps
    Quote Quote  
  7. vanished El Heggunte's Avatar
    Join Date: Jun 2009
    Location: Misplaced Childhood
    Search Comp PM
    Thanks for being faster than I, Mr. Deathray
    Quote Quote  
  8. If the frame rate isn't the issue try re-muxing the encoded MP4 using something else. Or even just use MKVMergeGUI to remux it as an MKV to see if the problem goes away. I've had sync/playback issues on the odd occasion which remuxing has fixed, especially using standalone players. Back when I was using CCCP it'd happen every now and then with MP4s. Either remuxing them as MKVs or using MPC-HC's internal splitter instead of Haali would solve the problem.
    Quote Quote  
  9. Member
    Join Date: Oct 2010
    Location: Brazil
    Search PM
    Hey everybody!

    Thanks for the answers!

    x264 --bitrate 1000 --fps 23.976 -o video.mp4 VideoFile.m2v

    it 'almost' solve the problem as the audio stills ~1 second ahead from video.

    x264 help:
    Code:
          --pulldown <string>     Use soft pulldown to change frame rate
                                  - none, 22, 32, 64, double, triple, euro (requires cfr input)
          --fake-interlaced       Flag stream as interlaced but encode progressive.
                                  Makes it possible to encode 25p and 30p Blu-Ray
                                  streams. Ignored in interlaced mode.
    i'm not sure how to use these options...

    it's funny, now the x264 video gets as big as ffmpeg's encoded. maybe 25fps dropped some frames from source...

    ffmpeg -y -i VideoFile.m2v -vcodec libx264 -b:v 1000k -an video.mp4
    Frame rate : 59.940 fps (wtf? i didnt put any deinterlace on it!)


    What is better for portability (bluray/dvd players mplayer, vlc, ...):
    - x264 ou ffmpeg?
    - avi or mp4 or mkv?
    Quote Quote  



Similar Threads