Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th July 2019, 09:14   #1  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
SVT-VP9 Framerate??

I've been playing with some compiled binaries my friend managed to find for me. But I'm having trouble with setting the proper FPS.

if I specify -fps-num 24000 -fps-denom 1001 it will output a file with 23.98 fps which ffmpeg does not like.

If I just tell it 24, ffmpeg will take it, but then the audio from the original source will be off by 1 second (source clip is 10 minutes, video file comes out to 9m59s)


Is it just not supported at this point, or is this some bug I have to wait for them to fix... Can I rescale the "FPS/duration" of the audio in ffmpeg as a compromise? What is the proper way to go about doing that?

edit:
Maybe a misunderstanding on my part. When I dump the input mkv file to YUV with ffmpeg it seems to want to assign it the 23.98 fps at that point.
I can't seem to get it to play nice in that regard

Last edited by osgZach; 18th July 2019 at 00:37.
osgZach is offline   Reply With Quote
Old 22nd July 2019, 23:01   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,889
Quote:
Originally Posted by osgZach View Post
I've been playing with some compiled binaries my friend managed to find for me. But I'm having trouble with setting the proper FPS.

if I specify -fps-num 24000 -fps-denom 1001 it will output a file with 23.98 fps which ffmpeg does not like.
How does ffmpeg not like it? Ffmpeg has had excellent support for fractional framerates for as long as I can remember.

Quote:
If I just tell it 24, ffmpeg will take it, but then the audio from the original source will be off by 1 second (source clip is 10 minutes, video file comes out to 9m59s)
Because you sped up the fps by 0.1%, and the video isn't. Any audio tool like Audition or Audacity can also resample your audio 0.1% faster; another way to fix your problem.

Quote:
Maybe a misunderstanding on my part. When I dump the input mkv file to YUV with ffmpeg it seems to want to assign it the 23.98 fps at that point.
I can't seem to get it to play nice in that regard
Did you specify the fps of the YUV? YUV doesn't have any metadata, so you need to manually specify fps along with a whole lot of other stuff. I much prefer .y4m for this, which is a yuv file but with metadata headers.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 24th July 2019, 18:31   #3  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
Yes, I always specified the FPS when importing the YUV. I was unaware it would take Y4M, so I may try going that route.
I think at some point I even tried throwing a framerate declaration on the YUV file during creation as well.

basically if I create a YUV file it'll come out as 23.98 fps. SVT will encode it as 23.98fps if I specify framerate as 24000/1001 IIRC

At that point I cannot get the IVF file muxed into a webm because ffmpeg would throw an error IIRC about invalid framerate.
I tried using mkvtoolnix (through the provided GUI) and it would always error out as well but not really give info on why it failed. I have only been able to successfully mux a file encoded by SVT when the framerate was a solid 23 or 24 fps.
-----

it's my day off, so I will prepare and do some more tests and post my workflow here so i can provide a better and more accurate picture.
osgZach is offline   Reply With Quote
Old 24th July 2019, 19:37   #4  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
I produced a Y4M with ffmpeg 4.1.3

The original source file chain was an MKV dump of one of my Lord of The Rings discs, which I cut into a 10 minute chunk of video (-ss -to )for testing purposes with various encoding schemes.

I further cut that chunk into a 1 minute chunk (-to) when I realized how huge a 10 minute YUV file was going to be.

Code:
ffmpeg -i LOTR-Test.mkv -an -to 00:01:00 "D:\SVT-VP9\LOTR-Test.y4m

----
Input #0, yuv4mpegpipe, from 'LOTR-Test.y4m':
  Duration: 00:01:00.02, start: 0.000000, bitrate: 596601 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Then I fed this file through SvtVp9EncApp.exe version 0.1.0
Code:
PS D:\SVT-VP9> ./SvtVp9EncApp.exe -i LOTR-Test.y4m -w 1920 -h 1080 -fps-num 24000 -fps-denom 1001 -b LOTR-Test.ivf
-------------------------------------
SVT-VP9 Encoder v0.1.0
SVT [version]   : SVT-VP9 Encoder Lib v0.1.0
SVT [build]     : Visual Studio 2017 64 bit
LIB Build date: May 24 2019 06:41:37
-------------------------------------------
Number of logical cores available: 12
Number of PPCS 30
-------------------------------------------
SVT [config]: Profile [0]       Level (auto)
SVT [config]: EncoderMode / Tune                                                : 9 / 1
SVT [config]: EncoderBitDepth                                                   : 8
SVT [config]: SourceWidth / SourceHeight                                        : 1920 / 1080
SVT [config]: Fps_Numerator / Fps_Denominator / Gop Size / IntraRefreshType     : 24000 / 1001 / 16 / 1
SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure          : 4 / 0 / 2
SVT [config]: BRC Mode / QP                                                     : CQP / 45
-------------------------------------------


Encoding      1439
SUMMARY --------------------------------- Channel 1  --------------------------------
Total Frames            Frame Rate              Byte Count              Bitrate
        1439            23.98 fps                  8787768              1171.35 kbps


Channel 1
Average Speed:          32.44 fps
Total Encoding Time:    44359 ms
Total Execution Time:   44561 ms
Average Latency:        2138 ms
Max Latency:            3220 ms
Encoder finished

Then I tried a straight mux
Code:
PS D:\SVT-VP9> ffmpeg -i LOTR-Test.ivf -codec copy LOTR-Test.webm
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom 
--enable-libmfx  --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[ivf @ 00000232b0628a00] Invalid frame rate
LOTR-Test.ivf: Invalid data found when processing input
PS D:\SVT-VP9>
At this point I am going to argue that I have no idea what I am doing wrong.

If I make changes to specify the framerate as either a straight 23 or 24 (i.e if I try -fps 23.98 SVT will round it down to 23fps) SVT will encode it and the file will mux fine into a webm.

Also of interesting note, on the 24000/1001 attempt if I try to open that file with mediainfo, it complaints about a floating point error. The Y4M opens fine, and a 23 or 24 fps IVF file will open fine.

just for kicks If I feed the encoder the y4m and only declare the width and height, it will encode it as 60fps but reports invalid framerate. when trying to open with ffmpeg - mediainfo will at least open it but reports an fps of 0.

So again, refering my very first attempt cited above, I just don't know what I'm doing wrong. Maybe I'm "special".

I know the SVT build is somewhat old but I'm not aware of any major fixes that would account for something like this?

Last edited by osgZach; 24th July 2019 at 19:41. Reason: fixed formating
osgZach is offline   Reply With Quote
Old 2nd August 2019, 00:29   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,889
Quote:
Originally Posted by osgZach View Post
Yes, I always specified the FPS when importing the YUV. I was unaware it would take Y4M, so I may try going that route.
I think at some point I even tried throwing a framerate declaration on the YUV file during creation as well.

basically if I create a YUV file it'll come out as 23.98 fps. SVT will encode it as 23.98fps if I specify framerate as 24000/1001 IIRC
What happens if you don't specify a frame rate at all? It might just pass it forward.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 2nd August 2019, 01:39   #6  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
When no framerate is specified it defaults to encoding 60fps and ffmpeg doesn't seem to like those files either. (I think it gives the same invalid framerate response, can't remember exactly)
osgZach is offline   Reply With Quote
Old 3rd August 2019, 19:17   #7  |  Link
MoSal
Registered User
 
Join Date: Jun 2013
Posts: 82
Can't reproduce with latest svt-av1 (master branch).

Note that the error comes from FFmpeg's ivf demuxer. You should be getting the same error if you just try to demux and decode the file:

Code:
ffmpeg -i LOTR-Test.ivf -c rawvideo -f null -
The error comes from here:
https://github.com/FFmpeg/FFmpeg/blo...fdec.c#L54-L63

So, either your file has an invalid ivf header, or the time_base info in the header is invalid.

My guess is your very old encoder binary (version 0.1) has an ivf mux bug that was fixed later.
__________________
saldl: a command-line downloader optimized for speed and early preview.
MoSal is offline   Reply With Quote
Old 3rd August 2019, 22:19   #8  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
Interesting. I'll endeavor to try and find a more recent version (compiling stuff for Windows isn't really my area, nor is installing a bunch of tools to do it).
I'll have to go back and look at my linux VM as well, that's an environment I could try and mess around with compiling stuff on I suppose.

Will report back here with my findings eventually.
osgZach is offline   Reply With Quote
Old 6th August 2019, 18:44   #9  |  Link
MoSal
Registered User
 
Join Date: Jun 2013
Posts: 82
Quote:
Can't reproduce with latest svt-av1 (master branch).
Actually, forget about that part of my comment. I thought you were testing the AV1 encoder.

I just tested the VP9 one (master branch). The issue you describe exists for me when no -fps-num/-fps-denom are passed. And checking with a hex editor confirms that the file header is invalid (0000 0000 03e8 0000 which corresponds to 0/1000 instead of 60000/1000). The floating point errors you are seeing are caused by division by zero.

However, when passing -fps-num 24000 -fps-denom 1001, I do get valid files. The header is valid (5dc0 0000 03e9 0000 which corresponds to 24000/1001), and the files are playable/mux-able.

It's worth mentioning that I tried many encoding settings, and I'm getting ghosts everywhere every time. So, you're not missing much. And I don't think anyone should bother with this encoder.
__________________
saldl: a command-line downloader optimized for speed and early preview.
MoSal is offline   Reply With Quote
Old 6th August 2019, 19:17   #10  |  Link
osgZach
Registered User
 
Join Date: Feb 2009
Location: USA
Posts: 658
Hi, yeah I noticed the 60fps thing as well. I did acquire a more recent compile from a friend and got it up and running on Ubuntu vis WSL. It did seem to fix the issue with 24fps files, although mediainfo being the quirk it is, still tells me its a solid 24 and not film 24 lol.. Audio and Video streams are in sync though.

I haven't looked too much into the quality of the encoder yet, but it certainly has limited uses for now... Definitely needs a 2 pass mode and when using CQ mode it doesn't seem to respect min-qp / max-qp flags.
osgZach is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.