VideoHelp Forum




+ Reply to Thread
Results 1 to 12 of 12
  1. Hi,.

    I would like to create from command line, or any other programming language (for example by using ffmpeg) a mpeg file that contains five frames, with a delay between each from of one minute.
    I know how to create a small mpeg file using five frames, but I do not know how to create a delay between each frame...
    I do not want to multiply the frames many times, in order to prevent it being a big file.

    ---
    Quote Quote  
  2. Mod Neophyte redwudz's Avatar
    Join Date
    Sep 2002
    Location
    USA
    Search Comp PM
    That sounds more like you need a slideshow program.
    Quote Quote  
  3. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Originally Posted by nighthawk2018
    Hi,.

    I would like to create from command line, or any other programming language (for example by using ffmpeg) a mpeg file that contains five frames, with a delay between each from of one minute.
    I know how to create a small mpeg file using five frames, but I do not know how to create a delay between each frame...
    I do not want to multiply the frames many times, in order to prevent it being a big file.

    ---
    Given mpeg is a video container format (as well as a compression scheme), you can really only create a video, which means frames passing at a given framerate. This means you will have to multiply your frames out to meet the right framerate and duration. If you were to author the file into a DVD format then you can get more control, as the format allows for delays at chapter points etc. However this is a lot ore complex, and would require the use of something like muxman as well as ffmpeg.
    Read my blog here.
    Quote Quote  
  4. I am a programmer, I programmed an opensource application that can be found on http://mp3slide.sourceforge.net -- I used open tools and some of the tools that I bought from other resources,.
    I once checked the muxman, bu tI do not recall whether it is a command line open source tool, or a gui interfaced tool.

    Do you know where can I find a tool that preform such a mpeg video, with delay... as I said in the original post, I wouldn't like to multiply the images into every frame, that will produce a huge file...
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Have you tried just setting the frame rate to 1 frame/minute (1/60 frame per sec)?
    Quote Quote  
  6. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    MPEG files seem to all be at standard TV rates, lowest 25 fps.

    I tried using HCEnc with a 1 fps file, it said "Error" Invalid MPEG2 frameratre" and exited.

    So I think you're going to have to use a normal frame rate.
    However, because of all the identical frames, MPEG compression will be very high and the filesize should not be too large.


    GuiforDVDAuthor has an "Audio titleset" mode that lets you use an image file to be the background image for an AC3 audio. You could use that to quickly generate a file, using five chapters, each with a one-minute audio and a background image.

    You could demux and just have a plain video file afterwards.

    You can look at the batch files GfD makes and modify them.

    I made this batch file to convert a PNG image and an AC3 file to an MPEG in that way:

    Code:
    @echo off
    echo Create PAL MPEG from AC3 and PNG (same rootname)
    echo PNG should be 720x576
    echo Usage: ac3-mpg file.ac3 or *.ac3
    @if %1X==X goto END
    :LOOP
    for %%A in (
    %1
    ) do (
    mkdir "%%~pA\AudioMpg"
    "P:\GUI4dvdauthor\png2yuv.exe" -n 1 -I p -L 0 -f 25 -j "%%~dpnA.png" | "P:\GUI4dvdauthor\mpeg2enc.exe" -f 8 -q 1 -b 5000 -a 2 -o "%%~pA\AudioMpg\%%~nA.m2v"
    "P:\GUI4dvdauthor\mplex.exe" -M -f 8 -o "%%~pA\AudioMpg\t%%~nA.mpg" "%%~pA\AudioMpg\%%~nA.m2v" "%%~dpnA.ac3"
    erase "%%~pA\AudioMpg\%%~nA.m2v"
    "P:\GUI4dvdauthor\insnav.exe" -o "%%~pA\AudioMpg\%%~nA.mpg" "%%~pA\AudioMpg\t%%~nA.mpg"
    erase "%%~pA\AudioMpg\t%%~nA.mpg"
    )
    SHIFT
    @if %1X==X goto END
    @goto LOOP
    :END
    The line :
    "P:\GUI4dvdauthor\png2yuv.exe" -n 1 -I p -L 0 -f 25 -j "%%~dpnA.png" | "P:\GUI4dvdauthor\mpeg2enc.exe" -f 8 -q 1 -b 5000 -a 2 -o "%%~pA\AudioMpg\%%~nA.m2v"

    might be modifed to do what you want.
    Quote Quote  
  7. Originally Posted by nighthawk2018
    Do you know where can I find a tool that preform such a mpeg video, with delay... as I said in the original post, I wouldn't like to multiply the images into every frame, that will produce a huge file...
    You will not be able to do that. MPEG only supports a handful of frame rates, flagged by a 4 bit field in the header:

    1 = 23.976
    2 = 24
    3 = 25
    4 = 29.97
    5 = 30
    6 = 50
    7 = 59.94
    8 = 60

    There is no way flagging other frame rates. You're only choice is to repeat your images at one of those rates.

    Your resulting file doesn't have to be too huge, MPEG is good at compressing exact duplicate frames. You could use very long GOPs to get even better compression if you don't need DVD player compatibility.
    Quote Quote  
  8. AlanHK,

    I do not know which parameter to change in order to create a delay...?
    ---
    Quote Quote  
  9. Here's an example of a long GOP (not DVD compatible), 720x576, 25 fps, MPEG 2 file:

    longgop.m2v

    Five different images, 25 seconds, 653 KB, ~200 kbps.

    Xvid AVI, similar bitrate:

    xvid.avi
    Quote Quote  
  10. jagabo,

    The problem is that I do need the DVD compatibility...
    Quote Quote  
  11. The same video with 15 frame MPEG 2 GOPs is about 1000 kbps.

    It's possible to encode a short video (at a normal MPEG 2 frame rate, one picture per frame) then use DVD authoring to repeat individual frames over and over again.
    Quote Quote  
  12. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by nighthawk2018
    AlanHK,

    I do not know which parameter to change in order to create a delay...?
    ---
    just type "mpeg2enc" and you get all its options.:

    Code:
    MPEG2ENC
    --verbose|-v num
        Level of verbosity. 0 = quiet, 1 = normal 2 = verbose/debug
    --format|-f fmt
        Encoding profile
        [0 = Generic MPEG1, 1 = standard VCD, 2 = user VCD,
         3 = Generic MPEG2, 4 = standard SVCD, 5 = user SVCD,
         6 = VCD Stills sequences, 7 = SVCD Stills sequences, 8|9 = DVD,
         10 = ATSC 480i, 11 = ATSC 480p, 12 = ATSC 720p, 13 = ATSC 1080i]
    --display-hsize|-x [32..16383]
       Set the the display-horizontal-size hint in MPEG-2 output to
       something other than the encoded image width
    --display-vsize|-y [32..16383]
       Set the the display-vertical-size hint in MPEG-2 output to
       something other than the encoded image height
    --aspect|-a num
        Set displayed image aspect ratio image (default: 2 = 4:3)
        [1 = 1:1, 2 = 4:3, 3 = 16:9, 4 = 2.21:1]
    --frame-rate|-F num
        Set playback frame rate of encoded video
        (default: frame rate of input stream)
        0 = Display frame rate code table
    --video-bitrate|-b num
        Set Bitrate of compressed video in KBit/sec
        (default: 1152.0 for VCD, 2500.0 for SVCD, 7500.0 for DVD)
    --ratecontroller|-A [0..1] (default:0)
        Specify ratecontrol alorithm
    --nonvideo-bitrate|-B num
        Non-video data bitrate to assume for sequence splitting
        calculations (see also --sequence-length).
    --quantisation|-q num
        Image data quantisation factor [1..31] (1 is best quality, no default)
        When quantisation is set variable bit-rate encoding is activated and
        the --bitrate value sets an *upper-bound* video data-rate
    --output|-o pathname
        Pathname of output file or fifo (REQUIRED!!!)
    --target-still-size|-T size
        Size in KB of VCD stills
    --interlace-mode|-I num
        Sets MPEG 2 motion estimation and encoding modes:
        0 = Progressive (non-interlaced)(Movies)
        1 = Interlaced source material (video)
        2 = Interlaced source material, per-field-encoding (video)
    --motion-search-radius|-r num
        Motion compensation search radius [0..32] (default 16)
    --reduction-4x4|-4 num
        Reduction factor for 4x4 subsampled candidate motion estimates
        [1..4] [1 = max quality, 4 = max. speed] (default: 2)
    --reduction-2x2|-2 num
        Reduction factor for 2x2 subsampled candidate motion estimates
        [1..4] [1 = max quality, 4 = max. speed] (default: 3)
    --min-gop-size|-g num
        Minimum size Group-of-Pictures (default depends on selected format)
    --max-gop-size|-G num
        Maximum size Group-of-Pictures (default depends on selected format)
        If min-gop is less than max-gop, mpeg2enc attempts to place GOP
        boundaries to coincide with scene changes
    --closed-gop|-c
        All Group-of-Pictures are closed.  Useful for authoring multi-angle DVD
    --force-b-b-p|-P
        Preserve two B frames between I/P frames when placing GOP boundaries
    --quantisation-reduction|-Q num
        Max. quantisation reduction for highly active blocks
        [0.0 .. 4.0] (default: 0.0)
    --quant-reduction-max-var|-X num
        Luma variance below which quantisation boost (-Q) is used
        [0.0 .. 2500.0](default: 0.0)
    --video-buffer|-V num
        Target decoders video buffer size in KB (default 46)
    --video-norm|-n n|p|s
        Tag output to suit playback in specified video norm
        (n = NTSC, p = PAL, s = SECAM) (default: PAL)
    --sequence-length|-S num
        Place a sequence boundary in the video stream so they occur every
        num Mbytes once the video is multiplexed with audio etc.
        N.b. --non-video-bitrate is used to the bitrate of the other
        data that will be multiplexed with this video stream
    --3-2-pulldown|-p
        Generate header flags for 3-2 pull down of 24fps movie material
    --intra_dc_prec|-D [8..11]
        Set number of bits precision for DC (base colour) of blocks in MPEG-2
    --reduce-hf|-N num
        [0.0..2.0] Reduce hf resolution (increase quantization) by num (default: 0.0)
    --keep-hf|-H
        Maximise high-frequency resolution - useful for high quality sources
        and/or high bit-rates)
    --sequence-header-every-gop|-s
        Include a sequence header every GOP if the selected format doesn't
        do so by default.
    --no-dummy-svcd-SOF|-d
        Do not generate dummy SVCD scan-data for the ISO CD image
        generator "vcdimager" to fill in.
    --playback-field-order|-z b|t
        Force setting of playback field order to bottom or top first
    --multi-thread|-M num
        Activate multi-threading to optimise throughput on a system with num CPU's
        [0..32], 0=no multithreading, (default: 0)
    --correct-svcd-hds|-C
        Force SVCD horizontal_display_size to be 480 - standards say 540 or 720
        But many DVD/SVCD players screw up with these values.
    --no-constraints
        Deactivate constraints for maximum video resolution and sample rate.
        Could expose bugs in the software at very high resolutions!
    --no-altscan-mpeg2
        Deactivate the use of the alternate block pattern for MPEG-2.  This is
        A work-around for a Bug in an obscure hardware decoder.
    --dualprime-mpeg2
        Turn ON use of dual-prime motion compensation. Default is OFF unless this op
    tion is used
    --custom-quant-matrices|-K kvcd|tmpgenc|default|hi-res|file=inputfile|help
        Request custom or userspecified (from a file) quantization matrices
    --unit-coeff-elim|-E num
        Skip picture blocks which appear to carry little information
        because they code to only unit coefficients. The number specifies
        how aggresively this should be done. A negative value means DC
        coefficients are included.  Reasonable values -40 to 40
    --b-per-refframe| -R 0|1|2
        The number of B frames to generate between each I/P frame
    --cbr|-u
        For MPEG-2 force the use of (suboptimal) ConstantBitRate (CBR) encoding
    --chapters X[,Y[,...]]
        Specifies which frames should be chapter points (first frame is 0)
        Chapter points are I frames on closed GOP's.
    --help|-?
        Print this lot out!
    So -F is what you want. And typing -F 0 gives you the options, same as Jagabo mentioned:

    mpeg2enc.exe -F 0
    Frame-rate codes:
    1 - 24000.0/1001.0 (NTSC 3:2 pulldown converted FILM)
    2 - 24.0 (NATIVE FILM)
    3 - 25.0 (PAL/SECAM VIDEO / converted FILM)
    4 - 30000.0/1001.0 (NTSC VIDEO)
    5 - 30.0
    6 - 50.0 (PAL FIELD RATE)
    7 - 60000.0/1001.0 (NTSC FIELD RATE)
    8 - 60.0
    Quote Quote  



Similar Threads

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