Skip to content

Commit 0c768bb

Browse files
committed
Add some notes on recording in regards to ffconcat
1 parent f78bcf3 commit 0c768bb

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

pkg/worker/caged/libretro/recording.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ type RecordingFrontend struct {
1515
}
1616

1717
func WithRecording(fe Emulator, rec bool, user string, game string, conf config.Recording, log *logger.Logger) *RecordingFrontend {
18-
19-
pix := ""
20-
switch fe.PixFormat() {
21-
case 0:
22-
pix = "rgb1555"
23-
case 1:
24-
pix = "brga"
25-
case 2:
26-
pix = "rgb565"
27-
}
28-
2918
rr := &RecordingFrontend{Emulator: fe, rec: recorder.NewRecording(
3019
recorder.Meta{UserName: user},
3120
log,
@@ -36,7 +25,6 @@ func WithRecording(fe Emulator, rec bool, user string, game string, conf config.
3625
Zip: conf.Zip,
3726
Vsync: true,
3827
Flip: fe.Flipped(),
39-
Pix: pix,
4028
})}
4129
rr.ToggleRecording(rec, user)
4230
return rr
@@ -70,6 +58,7 @@ func (r *RecordingFrontend) LoadGame(path string) error {
7058
}
7159
r.rec.SetFramerate(float64(r.Emulator.FPS()))
7260
r.rec.SetAudioFrequency(r.Emulator.AudioSampleRate())
61+
r.rec.SetPixFormat(r.Emulator.PixFormat())
7362
return nil
7463
}
7564

pkg/worker/recorder/ffmpegmux.go

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ const demuxFile = "input.txt"
1717
//
1818
// !to change
1919
//
20+
// - can't read pix_fmt from ffconcat
21+
// - maybe change raw output to yuv420?
22+
// - frame durations and size can change dynamically
23+
// - or maybe merge encoded streams
24+
//
25+
// new:
26+
//
27+
// ffmpeg -f image2 -framerate 59 -video_size 384x224 -pixel_format rgb565le \
28+
// -i "./f%07d__384x224__768.raw" \
29+
// -ac 2 -channel_layout stereo -i audio.wav -b:a 192K \
30+
// -c:v libx264 -pix_fmt yuv420p -crf 20 \
31+
// output.mp4
32+
//
33+
// old:
34+
//
2035
// ffmpeg -f concat -i input.txt \
2136
// -ac 2 -channel_layout stereo -i audio.wav \
2237
// -b:a 192K -crf 23 -vf fps=30 -pix_fmt yuv420p \

pkg/worker/recorder/recorder.go

+12
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@ func (r *Recording) Set(enable bool, user string) {
165165

166166
func (r *Recording) SetFramerate(fps float64) { r.opts.Fps = fps }
167167
func (r *Recording) SetAudioFrequency(fq int) { r.opts.Frequency = fq }
168+
func (r *Recording) SetPixFormat(fmt uint32) {
169+
pix := ""
170+
switch fmt {
171+
case 0:
172+
pix = "rgb1555"
173+
case 1:
174+
pix = "brga"
175+
case 2:
176+
pix = "rgb565le"
177+
}
178+
r.opts.Pix = pix
179+
}
168180

169181
func (r *Recording) Enabled() bool {
170182
r.Lock()

0 commit comments

Comments
 (0)