Set Keyframe Interval With HDHomeRun

Server Version#: 1.28.2.6151
Player Version#: 1.59.1.3398-dab42972
Tuner Make/Model: HDHomeRun FLEX QUATRO
Guide/Lineup name: Unsure how to find this
Using XMLTV?: Don’t think so
Channel number/Name: All of them

you trying to set something in the HDHomeRun?

New in here please be gentle.

Here is my dilemma. I record over the air TV using an HDHomeRun to my Plex. This records the shows as .TS (MPEG2) files to my Plex Library. I then use a custom Windows PowerShell script to find the .ts files and convert them to MPEG4 H.264 without doing any re-encoding. Here is the line where the PowerShell script calls this ffmeg command to do the conversion: “Start-Process “ffmpeg” -ArgumentList “-n -hide_banner -loglevel error -stats -i "$oldfile” -c:v libx264 -c:a copy "$newfile” " -wait -NoNewWindow"
The “-c:v” copies the video with no trans-coding and the “-c:a” copies the audio with no trans-coding
After they are converted I then manually edit the commercials out of the program I plan to keep as I find the built in Plex commercial removal to be buggy. I do the editing in Lossless Cut and only make cuts at keyframes. The benefit is there is no re-encoding of the video causing more loss.

Finally the problem. Is there a way where I can adjust where the Keyframe interval during this recording. The Keyframe location seams to vary anywhere from 5 to 2 seconds. I just want 2 seconds and done.

Thanks
Mesept

PS, If anyone wants to see the script I would happily share it. Just let me now.

I’m not sure where to set it, Plex or HDHomeRun. Please see my other post.

Now I see . You set that in the HDHomeRun. It is the stream source here.
PMS slaves itself to whatever interval the HDHomeRun sets

I suspected as much but am having problems finding where that is. Maybe an SSH session the GUI does not show it.

Thanks for responding.
Brent

This might be better asked either in their forum or of their tech support ?

Keyframes can only be created during transcoding

If I may interrupt with a related topic: This command does not convert the file without re-encoding the video. You’re changing an MPEG2 file to H264, which requires a full re-encode of the video. And your command reflects that: The ffmpeg command “-c:v libx264” will transcode the video from MPEG2 to H264 (do they not need to be deinterlaced? I don’t see any sign of deinterlacing, but this could be 720p video, which wouldn’t need deinterlacing). If you wanted to re-encode the video without re-encoding, you’d want -c:v copy", like you have with the audio. But that would keep the video codec as MPEG2.

OK, that post has light bulbs going off. Of course I’m trans-coding (face palm on my part not you). I just need to adjust my ffmeg command to do what I want by placing the keyframes at the intervals I want. Some times I need a simple push to get things in my brain correctly.

Thanks
Brent

I wanted to give my solution for anyone in the future who reads this thread.

After doing some investigation on the keyframe locations from the HDHomeRun. The MPEG2 video of the .TS file is 1 keyframe/sec at 59 frames/sec. The trans-code to MPEG4 using my settings above is variable up to 5 sec using ffmpeg. Per the libx264 documentation the default keyint size is 250, I think 250 is frames. I set keyint=60 and the key frame is now no longer then 1 sec which after experimenting is what I like for when I edit out the commercials manually (only on my favorite shows).

Here is my new PowerShell line to call ffmpeg:
Start-Process “ffmpeg” -ArgumentList “-n -hide_banner -loglevel error -stats -i "$oldfile” -c:v libx264 -x264-params keyint=60 -c:a copy "$newfile" " -wait -NoNewWindow

Thanks for steering me in the right direction. I think we can put a fork in this topic.