0

I have H.264 files that, when I run FFprobe on them, like this:

ffprobe -i h264_file.ts -show_packets -select_streams v

...it shows that each video packet has no values for duration, and no value for duration_time, like this:

...
[PACKET]
codec_type=video
stream_index=0
pts=8098077717
pts_time=89978.641300
dts=8098077717
dts_time=89978.641300
**duration=N/A
duration_time=N/A
convergence_duration=N/A
convergence_duration_time=N/A**
size=2354
pos=14633920
flags=_
[/PACKET]
...

My question is, other than re-encoding the file, and assuming I know the source to be 60 fps, is there a way to correct this video packet duration?

I know I can do it by re-encoding - I have done so successfully. But I am wondering if there is an easier and faster way of doing it.

2
  • Why do you need duration? The effective duration is the delta with the pts of the next frame.
    – Gyan
    May 21, 2019 at 18:02
  • Without the packet duration, MythTV thinks the transport stream file has a duration twice as long as it actually is. I think it defaults to 30fps, but this source generates files at 60 fps. May 24, 2019 at 2:07

1 Answer 1

0

I don't have a sample of your file so I don't know if this fixes it or not, but have you tried a simple remux?

ffmpeg -y -i h264_file.ts -c copy remuxed.ts

This is also basically the same thing, but helpful if you want video and audio in separate files before you remux:

ffmpeg -y -i h264_file.ts -map 0:0 -c:v copy -muxdelay 0 video.ts -map 0:1 -c:a copy -muxdelay 0 audio.ts
ffmpeg -y -copyts -i video.ts -i audio.ts -c copy remuxed.ts

You could also try reencoding audio but copying video. Encoding audio but copying video will be fast and usually concerns about reencoding loss is a lot less significant with audio. (Use audio synchronization, see -async in documentation.)

2
  • I hadn't considered re-muxing it - thanks for the suggestion. I will try it and reply back. May 24, 2019 at 2:08
  • Unfortunately, the re-muxing did not fix it. Specifically, I tried the two separate steps you listed. I also tried: ffmpeg -i ./file.ts -c copy file_remuxed.ts ffmpeg -i ./file.ts -c copy -vsync drop file_remuxed_vsync_drop.ts ffmpeg -i ./file.ts -c copy -r 60 file_remuxed_r60.ts ffmpeg -i ./file.ts -c copy -r 30 file_remuxed_r30.ts All resulted in packet durations of N/A when examined using ffprobe. May 25, 2019 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.