Add express transcode server! - #479
Closed
TheTacoScott wants to merge 1 commit into
Closed
Conversation
Collaborator
|
This branch is actually the precursor to the proper branch:
|
Owner
|
Very related: #603 got merged into main -- we now have a dedicated server file already set up with an express server and a decent UI 👍 |
Owner
|
I created my own PR as I'm working: #611 -- the code comes from @cal2195 🙇 @TheTacoScott -- let me know if it's OK to close this PR -- seems like we have virtually-identical code 🤝 |
Owner
|
Closing in favor of #611 -- thank you @cal2195 and @TheTacoScott for your work 🙇 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wouldn't expect a merge, but the idea is cool and wanted to discuss.
One of the issues I ran into when doing something similar with python and flask (using ffmpeg to transcode video to chrome) was that once you seek to an offset, from the web browsers perspective THAT is the new "00:00:00.000" starting point.
ffmpeg doesn't send the timecodes with the actual video's timecodes in mind, it sends from the perspective of the start time (the -ss time).
The flask code here:
Very similar place we both got it.
On the web side of things it became important to make your own progress bar instead of using the built in html5 progress bar.
video tag (forgive the angular1):
One would then need to dynamically set the source for that video and "play it"
Simple enough, but once you seek it gets all wierd.
I did it with a dumb interval thing in angular1
One would have to bootstrap the total timecode for a video that is about to be transcoded I did that with a separate endpoint but really it could come in the headers or the vha2 file itself.
`
@app.route('/duration/path:filename')
def transcode_duration(filename):
cmdline= list()
cmdline.append("/usr/bin/ffmpeg")
cmdline.append("-i")
cmdline.append("/" + filename);
duration= -1
FNULL = open(os.devnull, 'w')
proc= subprocess.Popen( cmdline, stderr=subprocess.PIPE, stdout=FNULL )
try:
for line in iter(proc.stderr.readline,''):
line= line.rstrip()
#Duration: 00:00:45.13, start: 0.000000, bitrate: 302 kb/s
m = re.search('Duration: (..):(..):(..)...', line)
if m is not None: duration= int(m.group(1)) * 3600 + int(m.group(2)) * 60 + int(m.group(3)) + 1
finally:
proc.kill()
`