VideoHelp Forum
+ Reply to Thread
Page 1 of 3
1 2 3 LastLast
Results 1 to 30 of 62
Thread
  1. I have 5 individual m2ts files (total time=04:48:39; total size 47,3GB) with AVC1 video encoding and Dolby AC3 audio encoding. The videos are 1080i and I would like to convert everything to 1080p 50fps, using Yadif deinterlacing with framerate doubler. My questions are:
    1) Can I use a single software in order to merge all files into one input, to apply the above desired deinterlace filter and to output the final video splitted in several parts?
    2) If the anwser of the question 1 is no, then what to use for each operation?
    3) What's the smallest accepted bitrate for the above given duration and 1080p 50fps output? I want to burn the final video on several DVD5 discs. I thought about splitting the video in 4 parts, so I get 01:12:10 per each part and each part to have a size of 4,35GB (4464 MB) to fit on a DVD5 disc. This should giev approx. 8000-8500kbps video bitrate. I want AAC's smallest VBR which doesn't get too low quality (I was thinking about 160-192kbps AAC VBR) as the output audio codec, as the input is AC3 2ch 256kbps CBR.

    I tried merging the m2ts files with tsmuxer, but it gives error when trying to open the audio stream and I think this is because it's Dolby AC3 2ch (maybe TrueHD, don't know - the videos where recorded using HD handheld video camera). I wanted to to this in order to input the file in MeGUI, because I've worked with it before, even it works with Yadif framerate doubler and it's easy to calculate bitrate. But I heard and also experienced in the past that MeGUI doesn't work well with TS/M2TS as I may experience audio/video desync (this happened in the past when I tried to convert a tv show recorded in 576i .ts).

    Thanks.
    Last edited by bloodhand; 2nd Feb 2017 at 14:41.
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    1) Yes. Starting from manually edited AviSynth scripts...

    3) One hour of 1080p50 on DVD-5? Nope.

    Simplified calculation: 4 GB (dec.) for the video stream only, 1 h playing time

    4*10^9 * 8 bit : 1920 : 1080 : 60 min/h : 60 s/min : 50 fps ~ 0.086 bppf (bits per pixel and frame). That will look ugly. Very ugly.
    Quote Quote  
  3. How good a 1 hour 1080p50 video at 4 GB looks will depend on the particular video. A slideshow or low action animation may look just fine. High action sports or noisy camcorder video will look poor.
    Last edited by jagabo; 3rd Feb 2017 at 08:23.
    Quote Quote  
  4. Thank you both for your answer.

    What should the Avisynth script look like in order to merge all the 5 files and have them opened in MeGUI? If I open a single file, it does the lsmash index for a single file and I guess I can't edit the avisynth script to open all files at once.

    About the quality, guess I will have to test.
    Quote Quote  
  5. Sample:

    Code:
    v1 = LWLibavVideoSource("file1.m2ts") #open each individual file
    v2 = LWLibavVideoSource("file2.m2ts")
    v3 = LWLibavVideoSource("file3.m2ts")
    v4 = LWLibavVideoSource("file4.m2ts")
    v5 = LWLibavVideoSource("file5.m2ts")
    
    v1++v2++v3++v4++v5 # append them
    Quote Quote  
  6. So is this gonna work?
    Code:
    v1 = LWLibavVideoSource("file1.m2ts")
    v2 = LWLibavVideoSource("file2.m2ts")
    v3 = LWLibavVideoSource("file3.m2ts")
    v4 = LWLibavVideoSource("file4.m2ts")
    v5 = LWLibavVideoSource("file5.m2ts")
    FFmpegSource("v1++v2++v3++v4++v5", vtrack = -1, atrack = -1, timecodes="timecodes_file.txt")
    Load_Stdcall_Plugin("yadif.dll")
    Yadif(mode=1, order=1)
    Quote Quote  
  7. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    No. LwLibavVideoSource already opened the files as video clips. There is no more use for FFmpegSource. Please note, this sample contains no audio...

    You can test AviSynth scripts in VDFilterMod with its included editor, and load them as video source into MeGUI in its main window when they work as expected. They don't have to be created by the MeGUI AVS Creator.
    Quote Quote  
  8. So how to input video & audio at the same time? I'm really confused right now how to do this, because using the @jagabo's code gives me this:
    Script Error: There is no function named "LWLibavVideoSource"
    Quote Quote  
  9. You need to download the plugin, it is not in the AviSynth package. https://www.dropbox.com/sh/3i81ttxf028m1eh/AAABkQn4Y5w1k-toVhYLasmwa?dl=0

    Multiple files with video + audio:
    Code:
    Load_Stdcall_Plugin("yadif.dll") # if needed for your binary
    
    v1 = LWLibavVideoSource("file1.m2ts")
    v1 = Yadif(v1, mode=1, order=1)
    a1 = LWLibavAudioSource("file1.m2ts")
    c1 = AudioDub(v1, a1)
    
    v2 = LWLibavVideoSource("file2.m2ts")
    v2 = Yadif(v2, mode=1, order=1)
    a2 = LWLibavAudioSource("file2.m2ts")
    c2 = AudioDub(v2, a2)
    
    c1++c2
    (I made individual calls to Yadif in case the interlacing differs between the clips, you could also do it at the end once for all of them if that is not the case)
    Quote Quote  
  10. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    MeGUI should have L-SMASH Works available. At least in the "development" version (you should switch the update location from "stable" to "development" in MeGUI options).
    Quote Quote  
  11. To include audio in the script:

    Code:
    function VideoAndAudio(string filename)
    {
      v = LWLibavVideoSource(filename) # get video
      a = LWLibavAudioSource(filename) # get audio
      AudioDub(v,a) # join them
    }
    
    v1 = VideoAndAudio("file1.m2ts") # get video and audio of each source clip
    v2 = VideoAndAudio("file2.m2ts")
    v3 = VideoAndAudio("file3.m2ts")
    v4 = VideoAndAudio("file4.m2ts")
    v5 = VideoAndAudio("file5.m2ts")
    
    v1++v2++v3++v4++v5 # join all five
    # other filtering goes here
    Last edited by jagabo; 3rd Feb 2017 at 10:45.
    Quote Quote  
  12. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    I remember that at least one of the indexing plugins (not sure if FFMS2 or LSMASH Works, though) had to re-index when the video was opened first, and the audio later, because opening the video first only writes an index for the video stream, but no audio streams.

    If you need both, you should open an audio stream first. If the plugin indexes everything anyway, it won't hurt; if it indexes audio streams only when audio is used, it avoids rebuilding the index file.
    Quote Quote  
  13. Yes, with ffmpeg it's faster to open the audio before the video so the index is built only once. I don't know it that's the case with LSMASH. If it is, just reverse the order they're opened in my VideoAndAudio() function.
    Quote Quote  
  14. Originally Posted by LigH.de View Post
    MeGUI should have L-SMASH Works available. At least in the "development" version (you should switch the update location from "stable" to "development" in MeGUI options).
    Still getting the same error even after I did everything you said, then hitting File->Open and chose the .avs. What to do?

    I also tried to download the filters from dropbox, but I have no idea where to unzip them.

    LE: Added LoadPlugin("D:\Programs\MeGUI\tools\lsmash\LSMASHS ource.dll") to the avs, now it started generating lwi files. Any idea long does this take as MEGUI window doesn't show me anything?
    Last edited by bloodhand; 3rd Feb 2017 at 11:39.
    Quote Quote  
  15. I believe MeGUI has a folder named "tools" and within that you'll find a folder named "avisynth_plugin". Try putting LSMASHSource.dll in that folder.
    Quote Quote  
  16. I fixed this issue. LWI created. It's ok. But how to open the LWI all the time when reloading the script in order to avoid LWI rebuilding everytime? Replacing m2ts with lwi in the script is enough?
    Quote Quote  
  17. If the index already exists it shouldn't need to be rebuilt.
    Last edited by jagabo; 3rd Feb 2017 at 12:35.
    Quote Quote  
  18. Thank you for all your help. You're right, I thought it regenerates the indexes everytime, but it was happening because I modified the avs so it figures.

    I tested with 8500kbps video and 160kbps aac audio and the resulted quality is ok for me. It's no cinema masterpiece, it's just a wedding recording. I wanted to have fps doubler (50fps) in order to have an as smooth as possible playback, which 25fps couldn't give me. Now let's hope there will be no audio-video desync at the end, as this happened before in MeGUI with a 576i .ts tv show I got online.
    Quote Quote  
  19. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    The problem is rather the opposite: If an index file *.lwi exists with the same name as the indexed media file, L-SMASH Works will use it, even if you exchange the media file against a different file with the same name, so that the index does not match anymore. You may have to delete an index file in addition to exchanging a media file (which is quite annoying if you keep producing different videos, e.g. out of a rendering tool, and want to process it further each time it is rendered anew; or you have a habit of extracting discs into the same directory always, so chances are high that VOB or MTS files with the same name get overwritten).
    Quote Quote  
  20. I had time and made the first enconding of the first of the 4 parts. The problem is, as expected, I get a/v desync. In the first 15 minutes of the 1h12m10s video, audio sync is ok, but about the half of the clip there is a 500ms desync, but in the last 10 minutes of the movie, audio is perflectly synced again. What is the problem? Video is x264 MP4 1080p 50fps and audio is encoded with QAAC (installed iTunes) in AAC 80kbps VBR, 2ch.

    I found the problem:
    1) When calculating input lenght outside MeGUI using an external player, I get a total of: 865956 frames.
    2) Inputted avs in MeGUI gives me: 865968 frames.

    I am out of ideas, guys. I've had this issue before with an 576i .ts with MeGUI, I couldn't figure it either.
    Last edited by bloodhand; 7th Feb 2017 at 16:20.
    Quote Quote  
  21. I converted the 5 initial m2ts files to mp4 files using -c copy command in ffmpeg. When I compare the total frames, they are different from the original m2ts files. I will try to reencode everything starting from these mp4 files instead of the m2ts.
    Quote Quote  
  22. If you check each input file individually using AviSynth do all of them have audio and video in sync?
    Quote Quote  
  23. How to do this? What to use to open avs files for playing?

    LE: Never mind, I figured it out. But I can't check, as the bitrate is very high and my CPU cannot play it fluently. I have a pretty old equipment, I had to wait 24h for 1h12m10s 1080p 50fps encoding... But this is all I have. I will try to open avs without yadif in the script.

    LLE: No, the sync issue is present within the .avs too. Wish I knew this in the first place - 24h wasted. I will try to open the MP4 I created from M2TS and check.
    Last edited by bloodhand; 7th Feb 2017 at 18:28.
    Quote Quote  
  24. Now when opening MP4 created with ffmpeg, MeGUI gives me a total of 866669 frames. Before, using avs directly on the m2ts videos, it had 865968 frames. That's about 14 seconds difference. I tested encoding small cuts from different location in the clip at a non-HD resolution (to obtain it faster) and there is no more desync at all. Let's hope it will be ok this time.

    I have no idea why this happened, but I guess that m2ts/ts containers may have had indexing issues and by copying the video and audio data to another container, it may have fixed the issues. I'll post back when I have the 1st DVD redone.
    Quote Quote  
  25. Got unlucky again, because after reaching the corresponding time for the first part of the 5 merged parts, MeGUI slows down processing under 1 fps per 5-6 seconds, so I now understand that there is an error somwhere: when ffmpeg converts m2ts to mp4 and merges all parts OR with lsmash.

    I also had to convert several MOV with 1080p avchd content and used lsmash for indexing. The problem is I get framedrops in the encoded video from 5 to 5 seconds and I thought there's something wrong. So I switched from lsmash to ffindex and now it's working properly with no issues. But I also losslessly converted the movs to mp4 and then concatenated them, all of these operation using ffmpeg. I noticed that the resulting MP4 was 3 seconds longer than the original movs.

    I'm gonna try switching to ffindex for the m2ts files as well, but not before I losslessly convert them to mp4 and concatenate them with ffmpeg in order to avoid any sound desync. Once bitten, twice shy.
    Quote Quote  
  26. I'm back again. I found the REAL problem: the audio is shorter than the video for each part (i.e. first part has 00:58:08 video and 00:58:07 audio). I tried extracting the audio outside MeGUI, but with no luck.

    WHY IS THIS HAPPENING? It's driving me crazy like hell, I have no idea what to do further...
    Quote Quote  
  27. Originally Posted by bloodhand View Post
    I'm back again. I found the REAL problem: the audio is shorter than the video for each part (i.e. first part has 00:58:08 video and 00:58:07 audio).
    That shouldn't matter if you followed the instructions you were given. Post your script.
    Quote Quote  
  28. What are the source videos ? Are they contiguous camcorder files from the same session? If so , you use the utility that comes with the camcorder. You need the entire folder structure, not just the individual files. Joins are seamless because there is metadata in the folder structure that enables a seamless join . NLE's use this method as well. Individual file joins without the folder structure can be unreliable or sometimes you get gaps or glitches
    Quote Quote  
  29. This is the script:
    Code:
    LoadPlugin("D:\Programs\Prelucrare Filme\MeGUI\tools\lsmash\LSMASHSource.dll")
    Load_Stdcall_Plugin("D:\Programs\Prelucrare Filme\MeGUI\tools\avisynth_plugin\yadif.dll")
    function VideoAndAudio(string filename)
    {
      v = LWLibavVideoSource(filename) # get video
      a = LWLibavAudioSource(filename) # get audio
      AudioDub(v,a) # join them
    }
    
    v1 = VideoAndAudio("in1.m2ts") # get video and audio of each source clip
    v2 = VideoAndAudio("in2.m2ts")
    v3 = VideoAndAudio("in3.m2ts")
    v4 = VideoAndAudio("in4.m2ts")
    v5 = VideoAndAudio("in5.m2ts")
    
    v1++v2++v3++v4++v5 # join all five
    Yadif(mode=1, order=1)
    # other filtering goes here
    However, I did some avs cuts in order to have a shorter encoding to test faster and not waste time to encode the whole parts. But I intend to encode the whole parts as one at a calculated bitrate as to split the MP4 at the end into 4x4,35GB parts.

    Encoding parameters are: 1920x1080 50fps 2pass 8550kbps video MP4 and QAAC 80kbps HE-AAC audio, didn't change rates or sample or anything.
    Resulted MP4 video is muxed with the M4A audio, but when played, the audio is synced at the start, but after ~15min, I get audio desync. I can't test a/v syncing everywhere in the file, as most of the video has background music and people ar talking only in some parts of the video, so these parts are all I have to test the syncing. Mostly middle parts of the file are out of sync.
    Quote Quote  
  30. Originally Posted by poisondeathray View Post
    What are the source videos ? Are they contiguous camcorder files from the same session? If so , you use the utility that comes with the camcorder. You need the entire folder structure, not just the individual files. Joins are seamless because there is metadata in the folder structure that enables a seamless join . NLE's use this method as well. Individual file joins without the folder structure can be unreliable or sometimes you get gaps or glitches
    Yes, they are videos recorded with camcorder. Unfortunately, this is all I have, as my brother in-law's cameraman only gave this to him. I am ready to quit joining the files before the encoding and join the resulted MP4 encoded files afterwards, in order to split back with MP4box at each 4,35GB. But the problem is that, even if I use this script:
    Code:
    LoadPlugin("D:\Programs\Prelucrare Filme\MeGUI\tools\lsmash\LSMASHSource.dll")
    Load_Stdcall_Plugin("D:\Programs\Prelucrare Filme\MeGUI\tools\avisynth_plugin\yadif.dll")
    function VideoAndAudio(string filename)
    {
      v = LWLibavVideoSource(filename) # get video
      a = LWLibavAudioSource(filename) # get audio
      AudioDub(v,a) # join them
    }
    
    v1 = VideoAndAudio("in1.m2ts") # get video and audio of each source clip
    Yadif(mode=1, order=1)
    # other filtering goes here
    , I still get a/v desync at the end. The m2ts has a lenght of 00:58:08, but the encoded MP4 video is 00:58:08 and the encoded M4A audio is 00:58:07.

    Now, I'm trying to mux the video of the first part's encoding with the audio from the original m2ts file and see what I got. But I believe there will be no desync.
    Last edited by bloodhand; 9th Feb 2017 at 11:59.
    Quote Quote  



Similar Threads

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