cms icon indicating copy to clipboard operation
cms copied to clipboard

Show duration (in hours) next to the video title

Open hkirat opened this issue 1 year ago • 8 comments

In the sidebar

hkirat avatar Mar 22 '24 13:03 hkirat

Will add this in #253

nimit9 avatar Mar 22 '24 13:03 nimit9

Currently, there is no video duration stored in our db

The way we can do this is whenever the admin adds the video metadata (which has the video url), we can use ffmpeg to get the video duration from the url and pass it along in the metadata.

In the videometadata table, duration column is already present, which will be mapped to whatever the duration we get from ffmpeg

P.S. I'm not sure how slow will ffmpeg work for large file.

The other option is to let the admin add duration itself.

@hkirat please let me know if this the correct approach?

nimit9 avatar Mar 22 '24 13:03 nimit9

Tried fluent-ffmpeg, but it requires ffmpeg to be installed on the machine. Will we be able to install it on the server? @hkirat

nimit9 avatar Mar 22 '24 15:03 nimit9

there should be duration in the db - https://github.com/code100x/cms/blob/main/prisma/schema.prisma#L104 This is in seconds

hkirat avatar Mar 22 '24 15:03 hkirat

How Is it getting added in prod db though? @hkirat In local, we're not setting it anywhere,not in the admin panel

nimit9 avatar Mar 22 '24 15:03 nimit9

@hkirat, could you please make sure if the duration is not null in the db, as it's allowed as null. Screenshot from 2024-03-24 18-39-18

if the video duration isn't there in the db, we would need to run a script which will add the duration to the existing VideoMetadata table, where duration is null. Also add the code for adding the duration for the new video added.

for this, we would need to use fluent-ffmpeg library, which requires ffmpeg installed on the machine.

Please assign me the issue if this is the correct approach

nimit9 avatar Mar 24 '24 12:03 nimit9

yeah people are adding it manually

hkirat avatar Mar 24 '24 13:03 hkirat

yeah people are adding it manually

Okay, cool, thanks!

nimit9 avatar Mar 24 '24 13:03 nimit9