How can I set dts to 40ms as pts starts 40ms after the stream starts with ffmpeg


I have a video which pts starts 40ms after the stream is started.

avidemux shows this information’s with this commandline

./avidemuxLinux_2.7.8_GLIBC_2.28_amd64.appImage --audio-codec copy --video-codec x265 --output-format MKV --load /media/alex/input_video.avi --save /media/alex/output_video_h265.mkv --quit
 [muxerMkv] 00:39:36-485  Creating Matroska muxer.
[VideoFilterBridge] Creating bridge from 0 s to 5587 s
 [convertLinearTimeToSeg] 00:39:36-485  End of last segment
 [getTimeBase] 00:39:36-485  Ref video 0 is frame-encoded, copy mode: 0
 [getTimeBase] 00:39:36-485  Timebase set to 1000 / 25000

--> [goToTimeVideo] 00:39:36-485  Fixating start time to 40 ms
--> [seektoTime] 00:39:36-485  Seeking to a keyframe at 40 ms

 [seektoTime] 00:39:36-485  Seeking to frame 0 at 40 ms
 [DecodePictureUpToIntra] 00:39:36-485  Decoding up to intra frame 0, ref: 0

 [postAmble] 00:39:36-638  First IDR out of encoder with DTS = -40000 us, setting encoder delay to 40000 us.

I have searched in the ffmpeg docs and found the “-use_mfra_for pts” but when I execute this commands below get I “moov atom not found”

~/Downloads/ffmpeg/ffmpeg-git-20211217-amd64-static/ffmpeg -hide_banner -y -f mp4 -use_mfra_for pts -i /media/alex/input_video.avi -c:v libx265 -x265-params interlace=1 -flags +ildct+ilme /media/alex/output_video_ffmpeg_x265.mkv

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7878d40] moov atom not found
ffprobe /media/alex/input_video.avi
Duration: 00:42:24.68, start: 0.000000, bitrate: 1154 kb/s
    Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 640x352 [SAR 1:1 DAR 20:11], 920 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 224 kb/s

Any hints how to tell ffmpeg to do the same thing as avidemux?


Read more here: Source link