VideoHelp Forum
+ Reply to Thread
Page 6 of 7
FirstFirst ... 4 5 6 7 LastLast
Results 151 to 180 of 183
Thread
  1. AudioDub(A, MergeChannels(B,C))
    Quote Quote  
  2. The command I gave you shows how to extract a pair of streams to a stereo channel.
    Quote Quote  
  3. Right, but when mapping, if I have 4.0 instead of 7.1 because there are two stereo tracks in the original instead of 5.1 and 2.0, what channels do I need to map? Front left and right and surround left and right?
    Quote Quote  
  4. The wiki has a list of channel mappings.
    Quote Quote  
  5. There are four four-channel options though:
    Code:
    4.0            FL+FR+FC+BC
    quad           FL+FR+BL+BR
    quad(side)     FL+FR+SL+SR
    3.1            FL+FR+FC+LFE
    Quote Quote  
  6. Why don't you just try them and find out? That would be far faster than coming here and asking.
    Quote Quote  
  7. Is there a way to tell ffmpeg what the layout is of the input file? I have a file with a mono audio track for the movie, and a stereo commentary track. I set up my batch file thinking it'd be treated as 3.0, but it threw an error because it'd decided the input was probably 2.1. So is there a way of telling ffmpeg what the input is so I don't have to trial-and-error my way through it every time?
    Quote Quote  
  8. Well this is weird. Here's the batch file I just ran:
    Code:
    for %%F in (*.mkv) do (
    echo A = LWLibAvVideoSource("%%F"^) > script.avs
    echo B = LWLibAvAudioSource("%%F",stream_index=1^) >> script.avs
    #echo C = LWLibAVAudioSource("%%F",stream_index=2^) >> script.avs
    #echo B = MergeChannels (B,C^) >> script.avs
    echo AudioDub(A,B^) >> script.avs
    echo AssumeFPS(24000,1001,sync_audio=true^) >> script.avs
    echo ResampleAudio(48000^) >> script.avs
    rem ffmpeg\ffmpeg.exe -i script.avs -aspect 16:9 -filter_complex "[0:1]channelmap=map=FL-FL|FR-FR|FC-FC|BR-BR|BL-BL|LFE-LFE:channel_layout=5.1" -filter_complex "[0:1]channelmap=map=SL-FL|SR-FR:channel_layout=stereo" -acodec ac3 -vcodec libx264 -preset slow -crf 18 "Output\%%F"
    ffmpeg\ffmpeg.exe -i script.avs -aspect 16:9 -acodec ac3 -vcodec libx264 -preset slow -crf 18 "Output\%%F"
    rem mkvextract "%%F" chapters chapters.txt tracks 2:subs.idx 3:subs.idx
    mkvextract "%%F" chapters chapters.txt
    mkvmerge -o "ChapterVersions\%%F" --chapter-sync 0,25000/23976 --chapters chapters.txt "Output\%%F"
    rem mkvmerge -o "ChapterVersions\%%F" --chapter-sync 0,25000/23976 --chapters chapters.txt "Output\%%F" --sync -1:0,25000/23976 subs.idx
    del "%%F.lwi"
    del script.avs
    del "chapters.txt"
    del "subs.idx"
    del "subs.sub"
    del "Output\%%F"
    )
    
    pause
    For some reason the console window returns two errors about not being able to find subtitle files despite that line being commented out.

    But apart from that, the chapters are in the wrong spots. They've moved, they don't have their old time codes, but they don't have the correct time codes either.
    Image Attached Files
    Quote Quote  
  9. "#echo" should be "REM echo" or "@echo"?
    Quote Quote  
  10. True, but I'm not sure it's relevant. I got muddled between AviSynth commenting and batch commenting there. But AFAIK it just goes "no idea what #echo means, let's skip this" which is the right result anyway.
    Quote Quote  
  11. I just noted the first obvious error I saw.

    The sub errors are because of the "del subs.idx" and "de. subs.sub" lines at the end of the batch file.

    I don't have an mkv file with chapters handy for testing the chapter issue.
    Quote Quote  
  12. Ah, right, of course.

    But yeah, chapters are the biggie. I have a box of PAL movies I'm going through and it was all going swimmingly until this one, when suddenly the chapters are completely out of whack.
    Quote Quote  
  13. I found one mkv file with chapter markers but it was VFR and nominally 23.976 fps already. After running the batch file the new video had A/V sync errors but the chapter points had the expected timing (~4 percent later).

    I changed the LWlibavVideoSource() line to include fpsnum=24000 and fpsden=1001 arguments and ran the batch file again. This time the new video had no A/V sync errors and the same running time as the source (as expected since it was already 23.976 fps). And the chapter points were ~4 percent later (which is what you expect going from 25 fps to 23.976 fps).

    So my analysis is your source is VFR and that's causing the errors you're seeing.
    Quote Quote  
  14. VFR? On a commercial DVD?
    Quote Quote  
  15. Add fpsnum and fpsden arguments to LWlibavVideoSource and see it it helps.
    Quote Quote  
  16. Num 25 and den 1?
    Quote Quote  
  17. Yes. Or 25000 and 1000.
    Quote Quote  
  18. Why not 25000000000 and 1000000000 while we're at it?
    Quote Quote  
  19. I like to use 25000/1000 because it's similar in scale to the exact NTSC values of 24000/1001, 30000/1001, and 60000/1001, and because it's more precise. I don't know if it matters to LWlibavVideoSource but many programs use 32 bit integers for the frame rate numerator and denominator. A number like 25000000000 is too large for a 32 bit integer and will cause those programs to screw up.
    Quote Quote  
  20. Got exactly the same result. Audio and video aren't in sync with each other, and the chapters aren't in sync with either of them.
    Quote Quote  
  21. I guess I'll have to see some m2v data.
    Quote Quote  
  22. mpeg 2 elementary stream. A sample of your source. Haven't you ever demuxed the mpeg 2 stream with DGIndex? It produces an m2v file.
    Quote Quote  
  23. I've actually never done that, no, just used it to create d2v files for AviSynth.

    I'm also not starting with the VOBs, but with MKV files created via MakeMKV. So I cut a small sample from that, no re-encoding or anything. Should achieve the same goal, but I can't attach it because Firefox alway times out when I do that. I'll give Chrome a shot in a sec.
    Quote Quote  
  24. Here we go.
    Image Attached Files
    Quote Quote  
  25. So you're using DgIndex to build a d2v file directly from the MKV file? In my experience that is prone to sync errors and video corruption. I recommend you demux the video stream to an MPG file MkvExtractGUI. Then use DgIndex on that MPG file.
    Quote Quote  
  26. No, DGIndex is not involved in this project. d2v files is just the only thing I've ever used it for in the past.

    I'm running the batch file I posted, directly on the MKV file.
    Quote Quote  
  27. Since LWlibavVideoSource is giving you sync errors with this video I'd still recommend you demux the video data to an MPG file, use DgIndex to build a d2v (honor pulldown flags mode), then open the video with Mpeg2Source() in AviSynth. That's the gold standard for dealing with MPEG2 video in AviSynth.
    Quote Quote  
  28. The chapter points should be unaffected by that though, shouldn't they? They don't line up with either the video or the audio on my output file.
    Quote Quote  
  29. If your video and audio aren't in sync there's something wrong with one or both of them. So the fact that the chapters don't sync with either may mean nothing. Looking at the timing of the chapter points I got exactly what was expected from slowing a 25 fps video to 23.976 fps. So the new chapter points are correct.

    Another thing I'm not sure about -- what happens when a chapter point doesn't coincide with a key frame in an MVK file? Does the player seek to the nearest keyframe? Does it try to seek frame accurately? Does it depend on the player and its settings? The default keyframe interval with x264 is 250 frames. So there can be more than 10 seconds between keyframes at 23.3976 fps. Keyframes in your AVC output don't correspond to keyframes in your MPEG2 source.
    Quote Quote  



Similar Threads

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