VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hi all,

    I have a folder with images that I've extracted from one video.
    The resolution for each image is 5760 X 2880.
    All images are in the following format:
    out-1.jpg, out-2.jpg , out-3.jpg ..... out-1000.jpg

    I tried couple of different ways to stich them:

    Using CPU - libx264
    Code:
    ffmpeg -r 30 -f image2 -s 5760X2880 -start_number 1 -i "AllFrames/out-%d.jpg" -vframes 119 -vcodec libx264 -crf 25  -pix_fmt yuv420p "/AllVideoChunks/Chunk_1.mp4"
    Worked well but the speed is about X0.05 only.


    Using GPU - h264_nvenc
    Code:
    ffmpeg -r 30 -f image2 -s 4000X2000 -start_number 1 -i "AllFrames/out-%d.jpg" -vframes 119 -vcodec h264_nvenc -gpu  0 -preset slow -b:v 75M  -pix_fmt yuv420p"/AllVideoChunks/Chunk_1.mp4"
    Working very fast and high quality, but the problem is that I can't use it for images and output bigger then width 4096


    Using GPU - hevc_nvenc
    Code:
    ffmpeg -r 30 -f image2 -s 5760X2880 -start_number 1 -i "AllFrames/out-%d.jpg" -vframes 119 -vcodec hevc_nvenc -gpu  0 -preset slow -b:v 75M  -pix_fmt yuv420p"/AllVideoChunks/Chunk_1.mp4"
    Working X10 more then the CPU at the speed of X0.5, good quality, but the problem is that I can't use it in normal players (can't play it in Unity)


    Is there another video codec that can work on GPU that support more then 4K resolution?
    Can I transform the 'hevc_nvenc ' output to 'h264' on GPU in higher resolution? should I do this transformation on CPU?
    Quote Quote  
  2. Originally Posted by SoftwareConductor View Post
    Hi all,

    I have a folder with images that I've extracted from one video.
    The resolution for each image is 5760 X 2880.
    All images are in the following format:
    out-1.jpg, out-2.jpg , out-3.jpg ..... out-1000.jpg

    I tried couple of different ways to stich them:
    General rules for stitching series of images is here https://trac.ffmpeg.org/wiki/Slideshow - seem you are following them (more or less)

    Originally Posted by SoftwareConductor View Post
    Using CPU - libx264
    libx264 is with default parameters, to speed-up encoding you may consider using different libx264 settings: https://trac.ffmpeg.org/wiki/Encode/H.264

    Originally Posted by SoftwareConductor View Post
    Using GPU - h264_nvenc
    Working very fast and high quality, but the problem is that I can't use it for images and output bigger then width 4096
    Seem there is HW limit on accepted resolution in your NVEnc - verify this with NVEnc supported resolution https://en.wikipedia.org/wiki/Nvidia_NVENC if you HW don't support resolutions higher than resolution of your files then you need to use or CPU encoding, reduce input pictures resolution or replace GPU.

    Originally Posted by SoftwareConductor View Post
    Using GPU - hevc_nvenc
    Working X10 more then the CPU at the speed of X0.5, good quality, but the problem is that I can't use it in normal players (can't play it in Unity)
    You need to verify if your decoder support such video resolution and video encoding type - usually HW decoders are limited by so called Profile and Level.
    Also SW decoders may have some limitations (such as memory limitations)

    https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels
    https://en.wikipedia.org/wiki/Advanced_Video_Coding#Profiles


    Originally Posted by SoftwareConductor View Post
    Is there another video codec that can work on GPU that support more then 4K resolution?
    Can I transform the 'hevc_nvenc ' output to 'h264' on GPU in higher resolution? should I do this transformation on CPU?
    This depends purely on HW capabilities of your graphic card - as you not providing any information on HW then there is no way to answer for your questions. You may think about using embedded GPU in your CPU (if your HW has this GPU present - usually some Intel and AMD CPU's provide such functionality).

    Whenever you are using GPU for video encode please verify drivers version installed in system - they may be additional dependencies there.
    Quote Quote  
  3. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Am going to suggest a different strategy: go back and start over. I am betting that the original video was NOT of 5760x2880 resolution (which is ~double the native rez of 4k cameras). Assuming this,
    Either
    re-extract at the original resolution (using something not lossy, like png), stitch, and and THEN do what necessary aspect change to 2:1 that you want. Much less problematic afa computer constraints.
    Or
    Use an NLE on your original video, marking your still extraction points as single frame clips in a clip library, and just edit, never leaving the NLE. 1000 clips is not that much, and with keyboard shortcuts/macros, you would already be finished (plus you would have complete control over the order). And then aspect adjustment.

    I bet there is a story behind that choice of resolution...


    Scott
    Quote Quote  
  4. Use hevc_nvenc instead of h264_nvenc. It allows up to 8K (depending on which generation GPU you have).
    Quote Quote  
  5. Hi Guys,
    Thank you all for your input! what a strong community to be part of!
    I would dive deep into the references!

    Some details about my machine:
    GPU - I'm using 2 graphic cards (RTX 3080 & RTX 3070).
    CPU - Intel Xeon W-2102
    Ram - 32GB
    SSD - 1T

    The video input is 5.7K, using camera: Insta360 X2.
    After stitching the 2 side video into a 360 video I'm getting a 5760x2880 @ 30FPS video.


    If there is a way to programmatically (I can code ) change the 'timespan' for each frame by a choice that would be super awesome and will solve all my problems
    Any suggested solution for this case?
    Quote Quote  
  6. Originally Posted by SoftwareConductor View Post
    If there is a way to programmatically (I can code ) change the 'timespan' for each frame by a choice that would be super awesome and will solve all my problems
    Any suggested solution for this case?

    I'm not clear on what you're asking about "timespan", but you can change the timestamps - this controls the display time per frame

    Indirect method is by changing the framerate . -r 30 means 30/1 fps . So the display time per frame is ~33.33ms - but that is essentially constant frame rate (CFR) because every frame has the same delta (that is, if the container timebase allows enough precision)

    If you need different timestamps per frame, look at v2 or v1 timestamp formats - they are described in the mkvmerge documentation

    16.1. Timestamp file format v1

    This format starts with the version line. The second line declares the default number of frames per second. All following lines contain three numbers separated by commas: the start frame (0 is the first frame), the end frame and the number of frames in this range. The FPS is a floating point number with the dot '.' as the decimal point. The ranges can contain gaps for which the default FPS is used. An example:

    # timestamp format v1
    assume 27.930
    800,1000,25
    1500,1700,30

    16.2. Timestamp file format v2

    In this format each line contains a timestamp for the corresponding frame. This timestamp must be given in millisecond precision. It can be a floating point number, but it doesn't have to be. You have to give at least as many timestamp lines as there are frames in the track. The timestamps in this file must be sorted. Example for 25fps:

    # timestamp format v2
    0
    40
    80

    To add the timestamp file, you can use mkvmerge for MKV container, or mp4fpsmod for MP4 container
    Last edited by poisondeathray; 14th Jan 2023 at 15:09.
    Quote Quote  
  7. OMG 😱

    I think V2 is exactly what I need!
    This will probably going to save me a 5 hours pipeline of video manipulation.

    I'll read more about that, and see if I can write the needed coded for my used case, to set those timestamp as I need.

    In my use case, what I did in a very 'painful way' is a pipeline of:

    1. Extract of all images.
    2. Stiching together 100 frames and set a different FPS for this piece.
    3. Stiching together all the pieces about.
    4. And the I got a movie with a dynamic FPS.
    I abused the FPS value to change the timestamp values for each frame but in a not accurate way.

    Changing the timestamp per frame might give me a more control about the quality of the video as a 'whole', the video speed effect.

    I'll keep you guys updated once I'll read about it more and implement it in my use case.
    Quote Quote  
  8. Originally Posted by SoftwareConductor View Post
    Some details about my machine:
    GPU - I'm using 2 graphic cards (RTX 3080 & RTX 3070).
    CPU - Intel Xeon W-2102
    Both NVidia cards are using Ampere series so HEVC with resolution up to 8192x8192 should be supported in HW NVEnc accordingly to NVidia.
    Check graphic driver version and used ffmpeg revision - generally you should always use latest drivers and ffmpeg build.
    Seem your CPU is not equipped with onboard GPU and as such there is no QuickSync there.

    Seem hevc_nvenc as jagabo suggest is best in your case, alternatively you may consider to keep jpeg (after converting it to mjpeg) - this will be fastest way to deal with your source.
    Quote Quote  
  9. pandy thanks a lot for your input.
    I'm going to heavily use my video card for video editing.
    Does the "QuickSync " give a significant boost?

    " you may consider to keep jpeg (after converting it to mjpeg) "
    What is mjpeg? I'm extracting image (jpeg) and them combining them to mp4 videos
    Quote Quote  
  10. Originally Posted by SoftwareConductor View Post
    Does the "QuickSync " give a significant boost?
    Yes, but I don't think your Xeon W-2102 supports it.

    Originally Posted by SoftwareConductor View Post
    What is mjpeg?
    The Motion JPEG codec -- essentially each frame is compressed as a JPEG image within the video file. I believe MJPEG is supported in the MOV container.
    Last edited by jagabo; 15th Jan 2023 at 17:41.
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    To add the timestamp file, you can use mkvmerge for MKV container, or mp4fpsmod for MP4 container

    Thank you poisondeathray for the reference, "mp4fpsmod" is the tool I was needed.
    Quote Quote  
  12. Thank you all for answering and helping me with this subject.
    I really appreciate your help with regards to my questions

    Wishing you all a great year
    Quote Quote  



Similar Threads

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