VideoHelp Forum

+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date
    May 2020
    Location
    Santiago, Chile
    Search Comp PM
    Is there any way to convert a 23.976p source to 59.94i applying a 3:2 pulldown with ffmpeg or any other Linux tool? I want to convert 23.976p videos to a 59.94i DVD output.

    My current method to do that is with Sony Vegas on a Windows VM, but that's rather slow.
    Quote Quote  
  2. dgpulldown if you can find a linux version
    Quote Quote  
  3. Member
    Join Date
    May 2020
    Location
    Santiago, Chile
    Search Comp PM
    The program just doesn't work, neither by running it under Wine or my Windows Vista VM. It gives an error that "The input file must be an elementary stream, not a program stream". I tried with an mpeg2 file without audio stream, but I still get the same error.
    Quote Quote  
  4. Demux the video stream:

    Code:
    ffmpeg -i input.mpg -c copy output.m2v
    Then use DgPulldown on that m2v. Note this only works with MPEG 2 video.
    Quote Quote  
  5. iirc. 'telecine=pattern=5555' should convert 23.976i to 59.94i
    Code:
    ffmpeg -i <path to input> -vf telecine=pattern=5555 <mpeg encoding settings> <path to output>
    That said, since you wrote 'DVD output' you probably want 29.97i which would be normal 'telecine' without a specific pattern (default is 23).

    Cu Selur

    Ps.: no clue about mpeg-2 encoding settings for DVD compatibility.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  6. Member
    Join Date
    May 2020
    Location
    Santiago, Chile
    Search Comp PM
    After some testings I ended up with these commands:

    First, I had to convert the video to a 23.976p DVD, otherwise the telecine filter doesn't work properly.
    Code:
    ffmpeg -i in.mp4 -f dvd -c:v:0 mpeg2video -aspect 16:9 -s 720x480 -r 24000/1001 -g 18 -pix_fmt yuv420p -b:v:0 4000000 -maxrate:v:0 9000000 -minrate:v:0 0 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 -force_key_frames 10:00,20:00 -b:a 192000 -ar 48000 -c:a:0 ac3 -map 0:V -map 0:a -map -0:s out.mpg
    Then, apply the telecine filter and bff field order.
    Code:
    ffmpeg -i out.mpg -vf telecine -alternate_scan:v:0 1 -f dvd -c:v:0 mpeg2video -aspect 16:9 -s 720x480 -r 29000/1001 -g 18 -pix_fmt yuv420p -b:v:0 5000000 -maxrate:v:0 9000000 -minrate:v:0 0 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 -force_key_frames 10:00,20:00 -b:a 192000 -ar 48000 -c:a:0 ac3 -map 0:V -map 0:a -map -0:s telecine.mpg
    I took the command that DVDstyler uses and modified it a bit. I'm still new to ffmpeg and scripting, so I'm pretty sure there are things in my command that could be improved, but so far it seems to work.
    Quote Quote  
  7. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    ^^ in your second code, surely it should be ........ r 30000/1001......

    Now it is always your choice as to which OS you use yet when you adopt one of the lesser used ones (or one that does not have a full range of utilities) you, as you have realised, often have to rely on a Windows VM to get you by.


    Your 'acid test' is when you actually create that actual dvd and be warned that, depending on the program used, if your mpeg file is not dvd-compliant the program will re-encode again (once being done by ffmpeg)


    So if you are finally going to rely on a VM you might like to try avstodvd with the original 23.976 video. This program will use avisynth to do it's work and it will only encode once.


    Just a thought for you.
    Quote Quote  
  8. Member
    Join Date
    May 2020
    Location
    Santiago, Chile
    Search Comp PM
    I wanted to do the conversion native on Linux with ffmpeg because my PC isn't that good, so a VM is not very reliable.

    Despite of the wrong framerate flag, ffmpeg still outputted a 29.97i video, so that flag in the second command is redundant. This is what the video looks like on Mediainfo:
    Code:
    General
    Complete name                            : /home/binarix128/telecine.mpg
    Format                                   : MPEG-PS
    File size                                : 757 MiB
    Duration                                 : 23 min 40 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 4 472 kb/s
    
    Video
    ID                                       : 224 (0xE0)
    Format                                   : MPEG Video
    Format version                           : Version 2
    Format profile                           : Main@Main
    Format settings, BVOP                    : No
    Format settings, Matrix                  : Default
    Format settings, GOP                     : N=18
    Format settings, picture structure       : Frame
    Duration                                 : 23 min 40 s
    Bit rate mode                            : Variable
    Bit rate                                 : 4 191 kb/s
    Maximum bit rate                         : 9 000 kb/s
    Width                                    : 720 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 16:9
    Frame rate                               : 29.970 (30000/1001) FPS
    Standard                                 : NTSC
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Interlaced
    Scan order                               : Bottom Field First
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.405
    Time code of first frame                 : 00:00:00:00
    Time code source                         : Group of pictures header
    GOP, Open/Closed                         : Open
    GOP, Open/Closed of first frame          : Closed
    Stream size                              : 710 MiB (94%)
    
    Audio
    ID                                       : 189 (0xBD)-128 (0x80)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Commercial name                          : Dolby Digital
    Muxing mode                              : DVD-Video
    Duration                                 : 23 min 40 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : -5 ms
    Stream size                              : 32.5 MiB (4%)
    Service kind                             : Complete Main
    
    Menu
    Yes I will burn a test DVD, then test it in 4 different DVD players.
    Quote Quote  
  9. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    Dgpulldown in Linux does work via wine (I use it in debian 11) on elementary streams. I'll post my script and sample desktop icon for drag and drop when I get off work
    if all else fails read the manual
    Quote Quote  
  10. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    For this to work you need:
    a 32 bit wine enviorment
    a elementary (.m2v) stream
    a filename without spaces.

    from a terminal in the DGPulldown directory run:

    wine start DGPulldown.exe

    this will start the GUI and you can click options and save

    to run straight from the command line with options do this, I run inplace as I'm a rebel lol:
    wine start DGPulldown.exe ../S05E05-Flesh_And_Stone.avs.m2v -srcfps 23.976 -destfps 29.97 -inplace

    a window will pop up but *not* show progress, this is fine and it will close as soon as it's done.

    if you need to remove all pulldown (useful if you mess up or have a source you know is 100% pulldown) do:
    wine start DGPulldown.exe ../S05E05-Flesh_And_Stone.avs.m2v -srcfps 23.976 -destfps 23.976 -inplace

    **if you omit start for command line conversions or have spaces the program will error out.

    with ffmpeg it only can do hard coded pulldown as far as I'm aware of in MPEG-2 so I'll use this method if I use ffmpeg as the encoder.

    I use HCenc, AvsPmod, and ffmpeg for audio, and subtitle editor all under linux via wine. for authoring of dvd's I use dvdstyler that I built under debian as a latest package aint avialable. Ubuntu etc do have packages so this shouldnt be a problem.

    Image
    [Attachment 66969 - Click to enlarge]
    attached is a photo for proof.
    if all else fails read the manual
    Quote Quote  
  11. Member Skiller's Avatar
    Join Date
    Oct 2013
    Location
    Germany
    Search PM
    I don't think the concept of pulldown does even work with 352x240 video. It works for 23.976 fps VCD but that seems to be a special application as it does not rely on flags.
    On DVD, only MPEG1 is allowed for 352x240 (but many hardware players won't complain).

    Also I don't get why you are using TDeint and then ChangeFPS("ntsc_video"). ntsc_video means it converts to 29.97?!
    Quote Quote  
  12. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    Sorry, side project in the background. For 240p video I do frame convert not telecine. For 480p video dgpulldown does work. Was just showing it running in Linux is all. Mpeg2 352x240 is a valid resolution for DVD (only 4x3 aspect though but my players don't care). Just on some players if it's telecined it doesn't look good so i just convert it to 29.97p so it doesn't pulldown on playback. I make 240p versions for my server and for multi movie backups for my portable DVD player. 480p doesn't have that issue.
    Last edited by dannyboy48888; 25th Sep 2022 at 09:06.
    if all else fails read the manual
    Quote Quote  
  13. Member Skiller's Avatar
    Join Date
    Oct 2013
    Location
    Germany
    Search PM
    Well then it looks good as far as I can tell. Do keep in mind that when encoding the maximum allowed GOP length for standard NTSC pulldown is 12 frames. The repeated fields count towards the limit even though they are generated on playback and are not encoded.


    Originally Posted by dannyboy48888 View Post
    Just on some players if it's telecined it doesn't look good so i just convert it to 29.97p so it doesn't pulldown on playback.
    That does not seem logical. If anything, standard NTSC pulldown would be much smoother than a simple frame repetition (23.976p to 29.97p) as it has twice the temporal resolution to spread (and thereby hide) the pattern.
    Quote Quote  
  14. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    On my cheap players it tries to field telecine a frame. With 240p there's not enough info and it looks like interlaced Video on a PC without a deinterlace filter. On my set top players they play fine. So I traded a little jerkyness on playback for ensured full frame playback on all my devices. For 23.976p even with pulldown yes it's 12 frames. For 29.97 it's 18 and for pal it's 15. Good info for those following this lol
    Last edited by dannyboy48888; 25th Sep 2022 at 10:16.
    if all else fails read the manual
    Quote Quote  
  15. Originally Posted by dannyboy48888 View Post
    On my cheap players it tries to field telecine a frame. With 240p there's not enough info and it looks like interlaced Video on a PC without a deinterlace filter,

    According to Wikipedia, 352x240 @ 23.976fps with pulldown flags is DVD compliant if it's encoded as mpeg2. For Mpeg1 it has to be 29.97fps progressive.

    Maybe 352x480 would be a better choice though? For AVSToDVD at least, it's referred to as "Half-D1".

    Anyway.... I gave AVSToDVD a 23.976fps input to play with and asked it to output 352x240, but I left it to it's own devices from there. I did the same again for a 352x480 output. In both cases AVSToDVD added flags with DGPulldown for 29.97fps.

    PS. In case you weren't aware, you can hard-telecine a 23.976fps video in Avisynth like so:

    AssumeFrameBased()
    SeparateFields()
    SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
    Weave()
    Quote Quote  
  16. Mr. Computer Geek dannyboy48888's Avatar
    Join Date
    May 2007
    Location
    Texas, USA
    Search Comp PM
    Thanks for the info on the telecine method. You are absolutely right that telecine is valid for 352x240and 352x480. On my cheap thirft store DVD player finds they don't always render it correctly for 240p pulled down, but do render full frames fine hence my changefps use. For me at least it spreads the jitter out more compared to tdecimate or srestore which will give smooth motion, jitter, than full motion when rendering to 29.97p. I'm also in Linux hence the post for the use of Dgpulldown manually as avs2dvd don't play nice in wine. Beauty of avisynth is there's many ways to get the result you need and my technique is what works well for me is all. If there's any other questions by all means let me know
    Last edited by dannyboy48888; 26th Sep 2022 at 09:49.
    if all else fails read the manual
    Quote Quote  



Similar Threads