VideoHelp Forum




+ Reply to Thread
Results 1 to 27 of 27
  1. A month ago I split a video into single frames. I needed to work on all the frames individually and also increase the resolution to 1440x960 (before it was 720x480). Now I wanted to put the frames together to make into a video again. But every time I rendered the video they audio would be out of sync. I ripped the audio using VLC media player into .mp3 format. Now I've tried both Blender and FFMPEG and they both cannot get the FPS right. I have don't have a clue what I'm doing wrong since I'm a complete newbie to video editing!

    So my question is how can I get the video to rendered at the right fps so the audio can sync?

    I will give you all the info that may help figure this issue out.

    ORIGINAL VIDEO INFO
    Video Run Time: 00:16:49 (HRS/MINS/SECS)
    Number of Frames: 28,385

    FPS:
    VLC Media Player: 28.135030
    MediaInfo: 28.131

    Here are pictures:
    MediaInfo

    VLC Media Player


    Now I've tried putting 28.135030 FPS when I rendered with FFMPEG but I got a different FPS after I rendered the video.


    Of course, the audio still did not sync.

    Also note that 3,380 frames are not in 1440x960 since I did not bother doing anything to the Credits. I'm not sure if that may be conflicting with the fps. IIRC Blender automatically increase the resolution when change the render settings to output to 1440x960. I'm not sure FFMPEG did that though.

    One last, thing I tried rendering the video into an MKV format and MP4 format and both had the same problems. I'm not sure if I'm supposed to rendered the video back to AVI format like the original video.
    Quote Quote  
  2. That is an uncommon / and non standard frame rate

    Did you say the original was "AVI" container ? Because that will rule out things like VFR (variable frame rate) immediately

    In what way is it out of sync ? audio too early , audio too late, or progressively worsenening ?

    With mediainfo, use view=>text, and copy/paste the text because that will show more information. Debug=>advanced mode will give even more information, including framecount . This type of information isn't always accurate, but it still can be helpful

    I'm not sure I understand you comment about the credits, but did you account for the audio in the credits (ie. if you omitted the credits, did you omit the audio in the credits as well)?
    Quote Quote  
  3. Originally Posted by poisondeathray View Post
    That is an uncommon / and non standard frame rate

    Did you say the original was "AVI" container ? Because that will rule out things like VFR (variable frame rate) immediately
    Whoops! I just checked and its NOT AVI, its actually MP4. My bad. And yes its very uncommon FPS.

    Originally Posted by poisondeathray View Post
    In what way is it out of sync ? audio too early , audio too late, or progressively worsenening ?General
    Audio seems to always go to fast.

    Originally Posted by poisondeathray View Post
    With mediainfo, use view=>text, and copy/paste the text because that will show more information. Debug=>advanced mode will give even more information, including framecount . This type of information isn't always accurate, but it still can be helpful
    Text
    General
    Complete name : OMITTED FOR PRIVACY REASONS.
    Format : MPEG-4
    Format profile : Base Media / Version 2
    Codec ID : mp42 (isom/mp42)
    File size : 358 MiB
    Duration : 16mn 49s
    Overall bit rate mode : Variable
    Overall bit rate : 2 973 Kbps
    Encoded date : UTC 2015-12-11 10:05:14
    Tagged date : UTC 2015-12-11 10:05:14

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4
    Format settings, CABAC : Yes
    Format settings, ReFrames : 5 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 16mn 49s
    Bit rate : 2 779 Kbps
    Maximum bit rate : 7 768 Kbps
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 16:9
    Original display aspect ratio : 16:9
    Frame rate mode : Variable
    Frame rate : 28.131 fps
    Minimum frame rate : 14.985 fps
    Maximum frame rate : 119.880 fps
    Original frame rate : 29.970 (30000/1001) fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.286
    Stream size : 334 MiB (93%)
    Writing library : x264 core 123 r2184+681M 5d72658
    Encoding settings : cabac=1 / ref=5 / deblock=1:-2:-2 / analyse=0x3:0x113 / me=umh / subme=7 / psy=1 / fade_compensate=0.00 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / sliced_threads=1 / slices=7 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / fgo=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=15.0000 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    Encoded date : UTC 2015-12-11 10:05:14
    Tagged date : UTC 2015-12-11 10:06:33

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 16mn 49s
    Bit rate mode : Variable
    Bit rate : 192 Kbps
    Maximum bit rate : 218 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Frame rate : 46.875 fps (1024 spf)
    Compression mode : Lossy
    Stream size : 22.8 MiB (6%)
    Encoded date : UTC 2015-12-11 10:06:32
    Tagged date : UTC 2015-12-11 10:06:33

    Debug => Advance Mode
    General
    Count : 322
    Count of stream of this kind : 1
    Kind of stream : General
    Kind of stream : General
    Stream identifier : 0
    Inform : MPEG-4 (Base Media / Version 2): 358 MiB, 16mn 49s
    Count of video streams : 1
    Count of audio streams : 1
    Video_Format_List : AVC
    Video_Format_WithHint_List : AVC
    Codecs Video : AVC
    Audio_Format_List : AAC
    Audio_Format_WithHint_List : AAC
    Audio codecs : AAC LC
    Complete name : D: OMMITTED FOR PRIVACY CONCERNS
    Folder name : D: OMMITTED FOR PRIVACY CONCERNS
    File name : OMMITTED FOR PRIVACY CONCERNS
    File extension : mp4
    Format : MPEG-4
    Format : MPEG-4
    Format/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
    Commercial name : MPEG-4
    Format profile : Base Media / Version 2
    Internet media type : video/mp4
    Codec ID : mp42
    Codec ID : mp42 (isom/mp42)
    Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
    CodecID_Compatible : isom/mp42
    Codec : MPEG-4
    Codec : MPEG-4
    Codec/Extensions usually used : mp4 m4v m4a m4b m4p 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma f4v
    File size : 375037866
    File size : 358 MiB
    File size : 358 MiB
    File size : 358 MiB
    File size : 358 MiB
    File size : 357.7 MiB
    Duration : 1009040
    Duration : 16mn 49s
    Duration : 16mn 49s 40ms
    Duration : 16mn 49s
    Duration : 00:16:49.040
    Duration : 00:16:53:21
    Duration : 00:16:49.040 (00:16:53:21)
    Overall bit rate mode : VBR
    Overall bit rate mode : Variable
    Overall bit rate : 2973423
    Overall bit rate : 2 973 Kbps
    Frame rate : 28.131
    Frame rate : 28.131 fps
    Frame count : 28385
    Stream size : 614075
    Stream size : 600 KiB (0%)
    Stream size : 600 KiB
    Stream size : 600 KiB
    Stream size : 600 KiB
    Stream size : 599.7 KiB
    Stream size : 600 KiB (0%)
    Proportion of this stream : 0.00164
    HeaderSize : 613998
    DataSize : 374423799
    FooterSize : 69
    IsStreamable : Yes
    Encoded date : UTC 2015-12-11 10:05:14
    Tagged date : UTC 2015-12-11 10:05:14
    File creation date : UTC 2015-12-12 01:26:12.675
    File creation date (local) : 2015-12-11 20:26:12.675
    File last modification date : UTC 2015-12-12 01:29:57.963
    File last modification date (local) : 2015-12-11 20:29:57.963

    Video
    Count : 334
    Count of stream of this kind : 1
    Kind of stream : Video
    Kind of stream : Video
    Stream identifier : 0
    StreamOrder : 0
    Inform : 2 779 Kbps, 720*480 (16:9), at 28.131 fps, AVC (High@L4) (CABAC / 5 Ref Frames)
    ID : 1
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format/Url : http://developers.videolan.org/x264.html
    Commercial name : AVC
    Format profile : High@L4
    Format settings : CABAC / 5 Ref Frames
    Format settings, CABAC : Yes
    Format settings, CABAC : Yes
    Format settings, ReFrames : 5
    Format settings, ReFrames : 5 frames
    Internet media type : video/H264
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html
    Codec : AVC
    Codec : AVC
    Codec/Family : AVC
    Codec/Info : Advanced Video Codec
    Codec/Url : http://developers.videolan.org/x264.html
    Codec/CC : avc1
    Codec profile : High@L4
    Codec settings : CABAC / 5 Ref Frames
    Codec settings, CABAC : Yes
    Codec_Settings_RefFrames : 5
    Duration : 1009040
    Duration : 16mn 49s
    Duration : 16mn 49s 40ms
    Duration : 16mn 49s
    Duration : 00:16:49.040
    Duration : 00:16:53:21
    Duration : 00:16:49.040 (00:16:53:21)
    Bit rate : 2778888
    Bit rate : 2 779 Kbps
    Maximum bit rate : 7768416
    Maximum bit rate : 7 768 Kbps
    Width : 720
    Width : 720 pixels
    Height : 480
    Height : 480 pixels
    Sampled_Width : 720
    Sampled_Height : 480
    Pixel aspect ratio : 1.185
    Display aspect ratio : 1.777
    Display aspect ratio : 16:9
    Original display aspect ratio : 1.778
    Original display aspect ratio : 16:9
    Rotation : 0.000
    Frame rate mode : VFR
    Frame rate mode : Variable
    Frame rate : 28.131
    Frame rate : 28.131 fps
    Minimum frame rate : 14.985
    Minimum frame rate : 14.985 fps
    Maximum frame rate : 119.880
    Maximum frame rate : 119.880 fps
    Original frame rate : 29.970
    Original frame rate : 29.970 (30000/1001) fps
    FrameRate_Original_Num : 30000
    FrameRate_Original_Den : 1001
    Frame count : 28385
    Resolution : 8
    Resolution : 8 bits
    Colorimetry : 4:2:0
    Color space : YUV
    Chroma subsampling : 4:2:0
    Chroma subsampling : 4:2:0
    Bit depth : 8
    Bit depth : 8 bits
    Scan type : Progressive
    Scan type : Progressive
    Interlacement : PPF
    Interlacement : Progressive
    Bits/(Pixel*Frame) : 0.286
    Stream size : 350497438
    Stream size : 334 MiB (93%)
    Stream size : 334 MiB
    Stream size : 334 MiB
    Stream size : 334 MiB
    Stream size : 334.3 MiB
    Stream size : 334 MiB (93%)
    Proportion of this stream : 0.93457
    Writing library : x264 - core 123 r2184+681M 5d72658
    Writing library : x264 core 123 r2184+681M 5d72658
    Encoded_Library_Name : x264
    Encoded_Library_Version : core 123 r2184+681M 5d72658
    Encoding settings : cabac=1 / ref=5 / deblock=1:-2:-2 / analyse=0x3:0x113 / me=umh / subme=7 / psy=1 / fade_compensate=0.00 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / sliced_threads=1 / slices=7 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / fgo=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=15.0000 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    Encoded date : UTC 2015-12-11 10:05:14
    Tagged date : UTC 2015-12-11 10:06:33

    Audio
    Count : 272
    Count of stream of this kind : 1
    Kind of stream : Audio
    Kind of stream : Audio
    Stream identifier : 0
    StreamOrder : 1
    Inform : 192 Kbps, 48.0 KHz, 2 channels, AAC (LC)
    ID : 2
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Commercial name : AAC
    Format profile : LC
    Format settings, SBR : No (Explicit)
    Format settings, SBR : No (Explicit)
    Codec ID : 40
    Codec : AAC LC
    Codec : AAC LC
    Codec/Family : AAC
    Codec/CC : 40
    Duration : 1009023
    Duration : 16mn 49s
    Duration : 16mn 49s 23ms
    Duration : 16mn 49s
    Duration : 00:16:49.023
    Duration : 00:16:46:16
    Duration : 00:16:49.023 (00:16:46:16)
    Bit rate mode : VBR
    Bit rate mode : Variable
    Bit rate : 192000
    Bit rate : 192 Kbps
    Maximum bit rate : 218120
    Maximum bit rate : 218 Kbps
    Channel(s) : 2
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Channel positions : 2/0/0
    ChannelLayout : L R
    Samples per frame : 1024
    Sampling rate : 48000
    Sampling rate : 48.0 KHz
    Samples count : 48433104
    Frame rate : 46.875
    Frame rate : 46.875 fps (1024 spf)
    Frame count : 47298
    Compression mode : Lossy
    Compression mode : Lossy
    Stream size : 23926353
    Stream size : 22.8 MiB (6%)
    Stream size : 23 MiB
    Stream size : 23 MiB
    Stream size : 22.8 MiB
    Stream size : 22.82 MiB
    Stream size : 22.8 MiB (6%)
    Proportion of this stream : 0.06380
    Encoded date : UTC 2015-12-11 10:06:32
    Tagged date : UTC 2015-12-11 10:06:33

    Originally Posted by poisondeathray View Post
    I'm not sure I understand you comment about the credits, but did you account for the audio in the credits (ie. if you omitted the credits, did you omit the audio in the credits as well)?
    Okay when I split the video into single frames from an anime show. I was doing some editing to the frames except the credits since I did not touch them at all.
    The show's frames are now 1440x960 resolution while the frames of the credits in the end of the show are still 720x480 since I did not touch them at all.
    Should I also increase the resolution? I remember Blender automatically increase the resolution for me for those frames that were not 1440x960.
    Audio is not included in this because I'm just working with the frames. I added the audio after I rendered the video because in the past I still was getting out of sync problems even if I added the audio during the image sequence to video in Blender.
    Pretty much I'm still working with 28,385 frames.
    Quote Quote  
  4. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Original container is MP4 and is VFR. Nominal frame rate is 28.131, minimum rate is 14.985 and max is 119.88!! Now, the original frame rate is 29.97. Your best bet is working with that original constant rate file if you have or can get it.

    Now, FFmpeg does not generate VFR MP4s, but does MKVs. And by exporting as images, you have stripped the original timestamp info.

    There may be a way to get around this. Try this using ffmpeg,

    Code:
    ffmpeg -i original.mp4 -i images%05d.png -filter_complex "[0]scale=1440x960,setsar=1[base];[1]scale=1440x960,setsar=1[img];[base][img]overlay=0:0[v]" -map "[v]" -map 0:a -vsync 0 -copyts -c:v libx264 -pix_fmt yuv420p -c:a copy output.mkv
    Quote Quote  
  5. Originally Posted by mulvya View Post
    Original container is MP4 and is VFR. Nominal frame rate is 28.131, minimum rate is 14.985 and max is 119.88!! Now, the original frame rate is 29.97. Your best bet is working with that original constant rate file if you have or can get it.

    Now, FFmpeg does not generate VFR MP4s, but does MKVs. And by exporting as images, you have stripped the original timestamp info.

    There may be a way to get around this. Try this using ffmpeg,

    Code:
    ffmpeg -i original.mp4 -i images%05d.png -filter_complex "[0]scale=1440x960,setsar=1[base];[1]scale=1440x960,setsar=1[img];[base][img]overlay=0:0[v]" -map "[v]" -map 0:a -vsync 0 -copyts -c:v libx264 -pix_fmt yuv420p -c:a copy output.mkv
    I'm getting an error message when I put that code in when I use FFMPEG.

    Could find no file with path 'images%05d.png' and index in the range 0-4 images%05.png: No such file or directory
    Sorry, but I'm a complete noob at using ffmpeg, since this is my first time using it. Your gonna have to explain so a dummy like me can understand. Like do I have to have the original video in the same folder with the images?
    By the way, I do know that the images have to named a certain way like for example;
    image-0.png
    or
    image-000.png
    My images start at image-0.png

    Thanks for helping me out on this. I really appreciated.
    Quote Quote  
  6. You would need to specify the full path

    eg
    If it was c:\folder , you would use -i "c:\folder\image-%03d.png"

    However, your images need to be consistently named, the "placeholder" digits have to use the same convention

    If you have 3 digits like image-000.png, image-001.png, image-003.png... it would be "c:\folder\image-%03d.png"

    If you had 5 digits like image-00000.png, it would be "c:\folder\image-%05d.png"



    Another way you could possibly do it is extract the timecodes from the original (it IS VFR, that' s the cause of your problem) , and insert them into the "final" version. But if you've done some editing like edit out credits, the timecodes might need to be adjusted. Editing VFR is very, very tricky. Usually you would convert to CFR before any manipulations. If you kept the same frames (same number), then the timecodes would work
    Quote Quote  
  7. I think I misread what you were doing

    Only a section was manipulated in blender, but now you have 1440x960 dimensions for that section. If that's the case, I would upscale everything to that (all the other frames) , if that was your desired final dimension. Or if you wanted to scale that back down to match, that would work too. Basically you need everything to match in dimensions

    So you would have the same number of frames as the original. If that ffmepg command doesn't work (try it first), you could extract the timecodes from the original with mp4fpsmod then re-insert them into the "final" version, also with mp4fpsmod. If you were re-encoding the whole thing, x264 can also take a timecodes file to create VFR with --tcfile-in. Basically it's the timecodes that control the VFR (the display time per frame), and there are several ways of extracting and inserting them.

    I would also "copy" the audio, instead of re-encoding it like you were with VLC. Not only will it be faster, the quality will be higher too. Mulvya's command reflects that with -c:a copy
    Quote Quote  
  8. Edit: looks like poisondeathray beat me to the timecodes idea with some alternative methods while I was writing this post.

    I haven't read the thread too thoroughly but it seems you have the original video and it's MP4? I've no idea if you can extract the timecodes from MP4s but you can from MKV, so it might be easiest to remux the MP4 as MKV with MKVMergeGUI (don't specify a frame rate) then extract the video timecosed with MKVCleaver or gMKVExtractGUI. They should extract as a text file.

    Open your encoded video with MKVMergeGUI. Make sure the video stream is selected, then add the timescodes. The place where they're added shouldn't be too hard to find. Add the audio. Remux as a new MKV. If the encoded video has exactly the same number of frames, the newly remuxed video should have the same variable frame rate as the source and the audio should sync. If it has less.... I can't remember to be honest. MKVMergeGUI will probably just remux the same way and stop when it runs out of video, or it might complain, but worse case scenario is you'll need to include the credits too so the frame count remains the same. I'm not really sure I understand what you're doing there to be honest. Does the output include the credits and are they the same resolution as everything else? If you want the credits they probably need to be re-encoded with the rest of the video.

    Thinking about it, it might be an idea to open the encoded video with MKVMergeGUI and add the extracted timecodes as I described, then add the source MP4 rather than your converted audio. In the list of streams, de-select the original video stream (from the MP4) and leave the audio stream checked. Remux as a new MKV. If there's any delay being applied to the audio stream in the original file, which MediaInfo doesn't seem to report for MP4s, it should be applied by MKVMergeGUI so the audio video sync won't change. If you do need to re-encode the audio.. if you need MP3 rather than AAC etc... that might at least provide some insight if the audio sync does change after it's extracted/converted converted, but if you don't need to re-encode the audio, that's probably best way to go about it.

    Your ffmpeg encode resulted in 4:4:4 YUV, which isn't something the average hardware player is likely to play. The usual format is 4:2:0. I'm not overly familiar with ffmpeg either, but specifying "-pix_fmt yuv420p" in the command line as mulvya suggested seems like a good idea.
    Quote Quote  
  9. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Originally Posted by poisondeathray View Post
    you could extract the timecodes from the original with mp4fpsmod then re-insert them into the "final" version, also with mp4fpsmod.
    Hey, that's a neat tool. Is there a precompiled Win binary available? I have MinGW set up on another sys, but a ready EXE is hassle-free.
    Quote Quote  
  10. Originally Posted by mulvya View Post
    Originally Posted by poisondeathray View Post
    you could extract the timecodes from the original with mp4fpsmod then re-insert them into the "final" version, also with mp4fpsmod.
    Hey, that's a neat tool. Is there a precompiled Win binary available? I have MinGW set up on another sys, but a ready EXE is hassle-free.
    For pages on github, there are typically several categories: commits, branch, releases, contributors, etc.. click on "releases"
    https://github.com/nu774/mp4fpsmod
    https://github.com/nu774/mp4fpsmod/releases
    Quote Quote  
  11. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    Only see the source in those packages.
    Quote Quote  
  12. Originally Posted by mulvya View Post
    Only see the source in those packages.
    That's very odd; I don't recall compiling it myself
    Image Attached Files
    Quote Quote  
  13. right, the original compiled versions are on the author's "cabinet" page. There's where I got it from

    The only difference in the one attached above, is I added a help.txt file

    https://sites.google.com/site/qaacpage/cabinet
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    You would need to specify the full path

    eg
    If it was c:\folder , you would use -i "c:\folder\image-%03d.png"

    However, your images need to be consistently named, the "placeholder" digits have to use the same convention

    If you have 3 digits like image-000.png, image-001.png, image-003.png... it would be "c:\folder\image-%03d.png"

    If you had 5 digits like image-00000.png, it would be "c:\folder\image-%05d.png"



    Another way you could possibly do it is extract the timecodes from the original (it IS VFR, that' s the cause of your problem) , and insert them into the "final" version. But if you've done some editing like edit out credits, the timecodes might need to be adjusted. Editing VFR is very, very tricky. Usually you would convert to CFR before any manipulations. If you kept the same frames (same number), then the timecodes would work
    That code is still not working. I'm getting the message "No such file or directory"
    Okay I think you guys may misunderstood me when I said this is the first time I'm using ffmpeg. I have little to no experience with it.
    The original file is not in the C drive its on another hard drive that I have.
    Both the original mp4 video file and images are in the same folder at this very moment.
    They are in:
    D:\Movie\C frames
    So how should the code go?
    Originally Posted by hello_hello View Post
    Edit: looks like poisondeathray beat me to the timecodes idea with some alternative methods while I was writing this post.

    I haven't read the thread too thoroughly but it seems you have the original video and it's MP4? I've no idea if you can extract the timecodes from MP4s but you can from MKV, so it might be easiest to remux the MP4 as MKV with MKVMergeGUI (don't specify a frame rate) then extract the video timecosed with MKVCleaver or gMKVExtractGUI. They should extract as a text file.

    Open your encoded video with MKVMergeGUI. Make sure the video stream is selected, then add the timescodes. The place where they're added shouldn't be too hard to find. Add the audio. Remux as a new MKV. If the encoded video has exactly the same number of frames, the newly remuxed video should have the same variable frame rate as the source and the audio should sync. If it has less.... I can't remember to be honest. MKVMergeGUI will probably just remux the same way and stop when it runs out of video, or it might complain, but worse case scenario is you'll need to include the credits too so the frame count remains the same. I'm not really sure I understand what you're doing there to be honest. Does the output include the credits and are they the same resolution as everything else? If you want the credits they probably need to be re-encoded with the rest of the video.

    Thinking about it, it might be an idea to open the encoded video with MKVMergeGUI and add the extracted timecodes as I described, then add the source MP4 rather than your converted audio. In the list of streams, de-select the original video stream (from the MP4) and leave the audio stream checked. Remux as a new MKV. If there's any delay being applied to the audio stream in the original file, which MediaInfo doesn't seem to report for MP4s, it should be applied by MKVMergeGUI so the audio video sync won't change. If you do need to re-encode the audio.. if you need MP3 rather than AAC etc... that might at least provide some insight if the audio sync does change after it's extracted/converted converted, but if you don't need to re-encode the audio, that's probably best way to go about it.

    Your ffmpeg encode resulted in 4:4:4 YUV, which isn't something the average hardware player is likely to play. The usual format is 4:2:0. I'm not overly familiar with ffmpeg either, but specifying "-pix_fmt yuv420p" in the command line as mulvya suggested seems like a good idea.
    Well if you read the OP then it might help you understand what I'm doing . Image sequence to video.

    Okay so I used some of the programs you mentioned. I remux the original file to mkv and I was able to extract the time codes using mkvcleaver. Thanks for the tips though and at least trying to help me. Strongly appreciated
    Last edited by e.korpse; 31st Mar 2016 at 18:28.
    Quote Quote  
  15. Okay, I got the code to work now.
    All I did was change all the images to image-%05.png format, so my images now started from image-00000.png, image-00001.png, image-00002.png....and so on. I renamed the original file to "original.mp4", so not much work there. Also I moved it to the same folder where the images/frames were at. From there I went to that folder, Press and hold shift and open command prompt from there. Now I copied the folder into Notepad because I noticed there was an error on there so I needed to edited. Instead of;
    Code:
    Images%05d.png
    I changed it to
    Code:
    Image-%05d.png
    I'm not sure if that may have been one of the problems why the code was not working in the first place.
    I copied and paste the file on the command prompt and it worked.
    Right now ffmpeg is rendering the file, I'll give an update when its done.

    edit
    FAILED!!
    Video and audio were still out of sync.
    Last edited by e.korpse; 31st Mar 2016 at 21:29.
    Quote Quote  
  16. Member
    Join Date
    Aug 2014
    Location
    India
    Search Comp PM
    How did you originally generate the images?
    Quote Quote  
  17. I used Photoshop CS6
    Quote Quote  
  18. Did you try any of the other timecode methods , such as mp4fpsmod or mkvtoolnix etc... ? There are other methods as well such as avisynth ffms2/ffindex but they all should give the same timecodes . If you have the same number of frames , it should work

    The other possibility is a playback problem . It says APU Richland 4 core @4.3 in your profile , that should be enough for 1440x960 h.264 playback
    Quote Quote  
  19. I have not tried mp4smod just yet because I'm not sure how to install it. Is it the same way as ffmpeg? I did use mkvtoolnix after I converted the original file to mkv format and I was able to extract the time code. But I don't know what to do with it now.

    I can play bluray's just fine on my desktop. So I'm pretty sure it can play video files like that just fine.
    Last edited by e.korpse; 1st Apr 2016 at 14:00.
    Quote Quote  
  20. If you already have the timecodes, easiest way is probably mkvtoolnix, because it's a GUI

    Add the file , highlight the video track, add the timecode , push start muxing . Your done!

    (There is a special place where you add the timecodes - it will say "timecode file" or something like that)

    In fact you can add the original video, uncheckmark the original video stream, but keep the audio stream checkmarked, add the new video stream, with that still selected, add the timecodes. This way you use the original audio

    If you want to use mp4fpsmod, you need to specify the paths and names , just like you did with ffmpeg

    Code:
    mp4fpsmod -t "timecodes.txt" "input.mp4" -o "output.mp4"
    Quote Quote  
  21. Actually you extracted the timecodes after converting to MKV ? Was the MKV in sync ? if not, you should extract them from the original
    Code:
    mp4fpsmod -p "timecodes.txt" "input.mp4"
    Then you take that timecodes.txt , and plug it into the new file with the command in the previous post
    Quote Quote  
  22. I think you forgot what the OP says; Image sequence to video. I still don't have the video!
    Should I now use ffmpeg to render the video from the image sequence? Also should I put the FPS to 29.97?

    Yes, the audio did sync together when I converted the ORGINAL video to mkv format.
    Quote Quote  
  23. Take your out of sync video that you already encoded with the image sequence, mux in timecodes, and it will become in sync if the number of frames is the same as the original. The FPS doesn't matter, because the timecodes control the display time per frame
    Quote Quote  
  24. Originally Posted by poisondeathray View Post
    Take your out of sync video that you already encoded with the image sequence, mux in timecodes, and it will become in sync if the number of frames is the same as the original. The FPS doesn't matter, because the timecodes control the display time per frame
    It worked!!!!!!!!!!!

    mp4fpsmod was the answer! I ripped the timecodes and use mkvtoolnix GUI and added the time code and the video and audio are now in synced. Earlier when you said:

    Originally Posted by poisondeathray View Post
    If you have the same number of frames , it should work
    That was the key, the problem earlier is that I was converting the original file to mkv and extract the timecodes off of those which I shouldn't have because that might have changed the number of frames and/or timecodes. And every time I would mux the files they would de-sync after a minute and other times it would increase the FPS to 49!
    The other day when you mentioned mp4fpsmod, I did not want to use it because I could not install it since I downloaded it from the github page when I google it. And when I downloaded that folder that had the .exe in it I open the command prompt from there and it worked!
    Thanks poisondeathray for the help.
    Quote Quote  
  25. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    FWIW... FFMPEG used to combine the first 2 images into some composite that would shorten your video and unsync it with any audio. I used to just start the images at images-001 and copy 001 to images-000 as a workaround. Haven't used it for this with the later levels but think it still does the same thing.

    Click image for larger version

Name:	ScreenHunter_190 Apr. 01 23.40.jpg
Views:	475
Size:	106.3 KB
ID:	36362
    Quote Quote  
  26. @budman1 - I don't think that that bug exists anymore, or at least it's not present in ffmpeg builds over the last few years

    The more common problem is when exporting image sequences with ffmpeg, they start with "one" instead of frame "zero" (e.g. img001.png instead of img000.png). Most software such as NLE's etc... "expect" to start at frame "zero". The "fix" for that is -start_number 0 .
    Quote Quote  
  27. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Great info poisondeathray, looks like I'll update my FFMpeg and adjust my program. Thanks Much.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!