[FFmpeg-user] How can I force a 360kHz time base?

Mark Filipak (ffmpeg) markfilipak at bog.us
Sat Feb 27 07:11:53 EET 2021


On 2021-02-26 22:53, Carl Zwanzig wrote:
> On 2/26/2021 5:55 PM, Mark Filipak (ffmpeg) wrote:
>> The source video is a 5 second MKV clip from a commercial DVD.
> 
> Instead of using unknown data*, I suggest making your own test video so you're absolutely sure of 
> all the parameters. You could do this with the ffmpeg testsrc or with something like 
> Premier/FCP/etc. I'd also consider different containers.
> 
> Example-
> ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 testsrc.mpg
> (that's _probably_ going to be correct; wouldn't hurt to check with an mpeg analyzer)

Hi Carl. Thanks!

testsrc.mpg.cmd
   ffmpeg -f lavfi -i testsrc=duration=5:size=1280x720:rate=30000/1001 testsrc.mpg

Above, I changed duration to '5' and rate to '30000/1001' in order to match what I had already done.

I next checked showinfo:
testsrc.mpg.showinfo.cmd
   ffmpeg -i testsrc.mpg -vf showinfo -f null - 2>testsrc.mpg.showinfo.txt

testsrc.mpg.showinfo.txt
   [Parsed_showinfo_0 @ 000001d2e3ee22c0] n:   1 pts:   3003 pts_time:0.0333667 ...
   [Parsed_showinfo_0 @ 000001d2e3ee22c0] n:   2 pts:   6006 pts_time:0.0667333 ...
   [Parsed_showinfo_0 @ 000001d2e3ee22c0] n:   3 pts:   9009 pts_time:0.1001    ...
   etc.

As you see, the PTSs are correct, and times are correct with 100ns resolution.

Next, I want to remux testsrc.mpg to testsrc.mkv in order to duplicate a source with 1kHz timebase, 
but I'll need your help because I don't know why the next script fails.

testsrc.mkv.cmd.
   ffmpeg -i testsrc.mpg -codec copy testsrc.mkv

ffmpeg started on 2021-02-26 at 23:45:17
Report written to "ffmpeg-20210226-234517.log"
Log level: 32
ffmpeg version N-100851-g9f38fac053 Copyright (c) 2000-2021 the FFmpeg developers
   built with gcc 9.3-win32 (GCC) 20200320
   configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config 
--cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 
--disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 
--enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig 
--enable-opencl --enable-libvmaf --enable-vulkan --enable-libvorbis --enable-amf --enable-libaom 
--enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm 
--enable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus 
--enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband 
--enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 
--enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libx264 --enable-libx265 
--enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC 
--extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
   libavutil      56. 64.100 / 56. 64.100
   libavcodec     58.119.100 / 58.119.100
   libavformat    58. 65.101 / 58. 65.101
   libavdevice    58. 11.103 / 58. 11.103
   libavfilter     7.100.100 /  7.100.100
   libswscale      5.  8.100 /  5.  8.100
   libswresample   3.  8.100 /  3.  8.100
   libpostproc    55.  8.100 / 55.  8.100
Input #0, mpeg, from 'testsrc.mpg':
   Duration: 00:00:04.97, start: 0.533367, bitrate: 715 kb/s
     Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 104857 kb/s, 
29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc
Output #0, matroska, to 'testsrc.mkv':
   Metadata:
     encoder         : Lavf58.65.101
     Stream #0:0: Video: mpeg1video (mpg1 / 0x3167706D), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 
q=2-31, 104857 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 000001a98be3bac0] Timestamps are unset in a packet for stream 0. This is deprecated and 
will stop working in the future. Fix your code to set the timestamps properly
[matroska @ 000001a98be3bac0] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
frame=   29 fps=0.0 q=-1.0 Lsize=     135kB time=00:00:00.90 bitrate=1225.9kbits/s speed= 662x
video:135kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003618%
Conversion failed!


More information about the ffmpeg-user mailing list