Add some notes on recording in regards to ffconcat

This commit is contained in:
Sergey Stepanov 2024-12-21 01:37:42 +03:00
parent f78bcf3e4b
commit 0c768bb3d6
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
3 changed files with 28 additions and 12 deletions

View file

@ -15,17 +15,6 @@ type RecordingFrontend struct {
}
func WithRecording(fe Emulator, rec bool, user string, game string, conf config.Recording, log *logger.Logger) *RecordingFrontend {
pix := ""
switch fe.PixFormat() {
case 0:
pix = "rgb1555"
case 1:
pix = "brga"
case 2:
pix = "rgb565"
}
rr := &RecordingFrontend{Emulator: fe, rec: recorder.NewRecording(
recorder.Meta{UserName: user},
log,
@ -36,7 +25,6 @@ func WithRecording(fe Emulator, rec bool, user string, game string, conf config.
Zip: conf.Zip,
Vsync: true,
Flip: fe.Flipped(),
Pix: pix,
})}
rr.ToggleRecording(rec, user)
return rr
@ -70,6 +58,7 @@ func (r *RecordingFrontend) LoadGame(path string) error {
}
r.rec.SetFramerate(float64(r.Emulator.FPS()))
r.rec.SetAudioFrequency(r.Emulator.AudioSampleRate())
r.rec.SetPixFormat(r.Emulator.PixFormat())
return nil
}

View file

@ -17,6 +17,21 @@ const demuxFile = "input.txt"
//
// !to change
//
// - can't read pix_fmt from ffconcat
// - maybe change raw output to yuv420?
// - frame durations and size can change dynamically
// - or maybe merge encoded streams
//
// new:
//
// ffmpeg -f image2 -framerate 59 -video_size 384x224 -pixel_format rgb565le \
// -i "./f%07d__384x224__768.raw" \
// -ac 2 -channel_layout stereo -i audio.wav -b:a 192K \
// -c:v libx264 -pix_fmt yuv420p -crf 20 \
// output.mp4
//
// old:
//
// ffmpeg -f concat -i input.txt \
// -ac 2 -channel_layout stereo -i audio.wav \
// -b:a 192K -crf 23 -vf fps=30 -pix_fmt yuv420p \

View file

@ -165,6 +165,18 @@ func (r *Recording) Set(enable bool, user string) {
func (r *Recording) SetFramerate(fps float64) { r.opts.Fps = fps }
func (r *Recording) SetAudioFrequency(fq int) { r.opts.Frequency = fq }
func (r *Recording) SetPixFormat(fmt uint32) {
pix := ""
switch fmt {
case 0:
pix = "rgb1555"
case 1:
pix = "brga"
case 2:
pix = "rgb565le"
}
r.opts.Pix = pix
}
func (r *Recording) Enabled() bool {
r.Lock()