jrudess / streamdvr

DVR for streaming entertainment
GNU General Public License v3.0
65 stars 16 forks source link

Manual conversion #122

Closed gittyVenison closed 5 years ago

gittyVenison commented 5 years ago

What command can manual convert files to mkv if streamdvr fails to do it itself. I found this command. Replace it with .ts input and mkv outpt, but it seems to go a lot slower then streamdvr does

for i in *.avi; do ffmpeg -i "$i" -qscale 0 "$(basename "$i" .avi)".mov ; done

Is there something else I should do

ghost commented 5 years ago

Try replacing -qscale 0 with -c copy, that should just remux the video and audio track from the input container into the output mkv container.

jrudess commented 5 years ago

You can find the options that streamdvr uses in scripts/postprocess_ffmpeg.sh

ffmpeg -hide_banner -v fatal -i "$input" -c copy $mp4args -copyts -start_at_zero -analyzeduration 300000000 "$output" > $tmp/stdout 2> $tmp/stderr
jrudess commented 5 years ago

When converting to mkv $mp4args is empty. If you want to convert to mp4, then replace that part with -bsf:a aac_adtstoasc

jrudess commented 5 years ago

Reopening this issue. Will use this sighting to track implementation of a better flow to be able to automatically continue converting if streamdvr crashes, or is shutdown before all conversions can finish.

jrudess commented 5 years ago

I think what I will do is this:

jrudess commented 5 years ago

The post-process queue is an independent 'thread' from the main polling loop, so it should not delay startup. I will verify this in testing before committing.

gittyVenison commented 5 years ago

This is what works for me for i in .ts; do ffmpeg -i "$i" -c copy $mp4args -copyts -start_at_zero -analyzeduration 3000000000 "${i%.}.mkv" ; done

Although -c copy works as well

Can't get basename not to do double extension

jrudess commented 5 years ago

Some hiccups now that I'm starting implementation. The current postprocess flow relies on a few pieces of info that are not readily available in a startup situation.

This is not a simple resolution in the current code architecture, but one possible fix is to change how the capture directory works to be always hierarchical:

capturing/SITE/streamer/file.ts

Then it is possible, regardless of whether config.yml changes between restarts, to easily parse out the site and streamer for the file that is being converted.

jrudess commented 5 years ago

My initial idea was still going to be a pretty big rewrite of some sections of logic, so I've opted for a compromise for the near-term. Left-over .ts files that are converted at startup are now placed in "captured/UNKNOWN/filename.mp4"