Grid of videos starting at different times

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Grid of videos starting at different times

FFmpeg-users mailing list
Hello,

I have several videos that were recorded in a webinar type setting.

Each person in the webinar was recorded with their own feed.

I then receive a zip file with each video recording and a JSON file with a start / stop time offset.

Example:

Video 1:

 "filename" : "823ef68a-cb1c-4636-bdfb-ed3d9611a755.webm",
"size" : 4766189,
 "startTimeOffset" : 17599,
"stopTimeOffset" : 72696,

Video 2:

"filename" : "a920ab58-a42d-49fe-a239-b27497b22bb1.webm",
 "size" : 6378071,
 "startTimeOffset" : 1439,
 "stopTimeOffset" : 74655,


I could have anywhere from 2 to 10 videos per job.

For faster processing I convert the videos to Mp4

I have had some luck in merging the videos into 1 using hstack but I cannot seem to figure out how to get them merged into 1 video with the different time offsets.

Here is what I have so far which gets me close but doesn't take into account the different offsets so everyone is talking over each other and out of order etc.

ffmpeg -i /Users/randy/Downloads/archive23/a920ab58-a42d-49fe-a239-b27497b22bb1.mp4 -i /Users/randy/Downloads/archive23/823ef68a-cb1c-4636-bdfb-ed3d9611a755.mp4 -filter_complex \
"[0:v][1:v]hstack=inputs=2[v]; \
 [0:a][1:a]amerge[a]" \
-map "[v]" -map "[a]" -ac 2 -y /Users/randy/Downloads/archive23/output.mp4

Another tricky thing is that if the conference was 1 hour long, someone could show up 15 minutes late or leave 15 minutes early.

I thought 
ffmpeg -itsoffset n
could be of help but https://stackoverflow.com/questions/55492772/stacking-different-length-videos-not-working-with-ffmpeg-and-itsoffset this post says that hstack doesn't sync with timestamps.

They do give an example in the stack overflow post:
ffmpeg \
-i smaller.mp4 \
-i bigger.mp4 \
-filter_complex \
 "[0]tpad=start_duration=17[left];\
  [left][1]hstack=inputs=2;\
 [0]adelay=17s|17s[lefta];[lefta][1]amix=2" \
-c:v libx264 -crf 23 out.mp4

Any ideas on the best way for me to proceed?

Thanks,

Randy
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

Paul B Mahol
On 8/11/20, Randy Johnson via ffmpeg-user <[hidden email]> wrote:

> Hello,
>
> I have several videos that were recorded in a webinar type setting.
>
> Each person in the webinar was recorded with their own feed.
>
> I then receive a zip file with each video recording and a JSON file with a
> start / stop time offset.
>
> Example:
>
> Video 1:
>
>  "filename" : "823ef68a-cb1c-4636-bdfb-ed3d9611a755.webm",
> "size" : 4766189,
>  "startTimeOffset" : 17599,
> "stopTimeOffset" : 72696,
>
> Video 2:
>
> "filename" : "a920ab58-a42d-49fe-a239-b27497b22bb1.webm",
>  "size" : 6378071,
>  "startTimeOffset" : 1439,
>  "stopTimeOffset" : 74655,
>
>
> I could have anywhere from 2 to 10 videos per job.
>
> For faster processing I convert the videos to Mp4
>
> I have had some luck in merging the videos into 1 using hstack but I cannot
> seem to figure out how to get them merged into 1 video with the different
> time offsets.
>
> Here is what I have so far which gets me close but doesn't take into account
> the different offsets so everyone is talking over each other and out of
> order etc.
>
> ffmpeg -i
> /Users/randy/Downloads/archive23/a920ab58-a42d-49fe-a239-b27497b22bb1.mp4 -i
> /Users/randy/Downloads/archive23/823ef68a-cb1c-4636-bdfb-ed3d9611a755.mp4
> -filter_complex \
> "[0:v][1:v]hstack=inputs=2[v]; \
>  [0:a][1:a]amerge[a]" \
> -map "[v]" -map "[a]" -ac 2 -y /Users/randy/Downloads/archive23/output.mp4
>
> Another tricky thing is that if the conference was 1 hour long, someone
> could show up 15 minutes late or leave 15 minutes early.
>
> I thought
> ffmpeg -itsoffset n
> could be of help but
> https://stackoverflow.com/questions/55492772/stacking-different-length-videos-not-working-with-ffmpeg-and-itsoffset
> this post says that hstack doesn't sync with timestamps.

Post is invalid. hstack use timestamps to sync its inputs.
hstack expect same timestamps from all its inputs.

Your inputs have different starts and durations/ends and thus what
should be inserted between gaps?

You could theoretically generate filtergraph by using supplied
parameters, but that would be
very complicated at best.

>
> They do give an example in the stack overflow post:
> ffmpeg \
> -i smaller.mp4 \
> -i bigger.mp4 \
> -filter_complex \
>  "[0]tpad=start_duration=17[left];\
>   [left][1]hstack=inputs=2;\
>  [0]adelay=17s|17s[lefta];[lefta][1]amix=2" \
> -c:v libx264 -crf 23 out.mp4
>
> Any ideas on the best way for me to proceed?
>
> Thanks,
>
> Randy
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

FFmpeg-users mailing list
Hi Paul & All,

I did get this code to work with 2 videos yesterday.  The box for the one video is just black until it finally starts.  

ffmpeg \
-i /Users/randy/Downloads/archive23/823ef68a-cb1c-4636-bdfb-ed3d9611a755.mp4 \
-i /Users/randy/Downloads/archive23/a920ab58-a42d-49fe-a239-b27497b22bb1.mp4 \
-filter_complex \
 "[0]tpad=start_duration=17.559[left];\
  [left][1]hstack=inputs=2;\
 [0]adelay=17599|17599[lefta];[lefta][1]amix=2" \
-c:v libx264 -crf 23 out.mp4 -y

I did a ton of reading yesterday but cannot figure out how to expand this to more than 2 videos.

I am getting hung up on how to read the complex_filter.  Specifically the [left] and [lefta]

I also tried adding 

"[1]tpad=start_duration=1.439 [right];\

and then use right everywhere there was a 1

but it gave me an error Invalid stream specifier: right.

Do you mind explaining the complex filter a bit?

Thank You,

Randy 

Paul B Mahol <[hidden email]> wrote:
“On 8/11/20, Randy Johnson via ffmpeg-user <[hidden email]> wrote:

> Hello,
>
> I have several videos that were recorded in a webinar type setting.
>
> Each person in the webinar was recorded with their own feed.
>
> I then receive a zip file with each video recording and a JSON file with a
> start / stop time offset.
>
> Example:
>
> Video 1:
>
> "filename" : "823ef68a-cb1c-4636-bdfb-ed3d9611a755.webm",
> "size" : 4766189,
> "startTimeOffset" : 17599,
> "stopTimeOffset" : 72696,
>
> Video 2:
>
> "filename" : "a920ab58-a42d-49fe-a239-b27497b22bb1.webm",
> "size" : 6378071,
> "startTimeOffset" : 1439,
> "stopTimeOffset" : 74655,
>
>
> I could have anywhere from 2 to 10 videos per job.
>
> For faster processing I convert the videos to Mp4
>
> I have had some luck in merging the videos into 1 using hstack but I cannot
> seem to figure out how to get them merged into 1 video with the different
> time offsets.
>
> Here is what I have so far which gets me close but doesn't take into account
> the different offsets so everyone is talking over each other and out of
> order etc.
>
> ffmpeg -i
> /Users/randy/Downloads/archive23/a920ab58-a42d-49fe-a239-b27497b22bb1.mp4 -i
> /Users/randy/Downloads/archive23/823ef68a-cb1c-4636-bdfb-ed3d9611a755.mp4
> -filter_complex \
> "[0:v][1:v]hstack=inputs=2[v]; \
> [0:a][1:a]amerge[a]" \
> -map "[v]" -map "[a]" -ac 2 -y /Users/randy/Downloads/archive23/output.mp4
>
> Another tricky thing is that if the conference was 1 hour long, someone
> could show up 15 minutes late or leave 15 minutes early.
>
> I thought
> ffmpeg -itsoffset n
> could be of help but
> https://stackoverflow.com/questions/55492772/stacking-different-length-videos-not-working-with-ffmpeg-and-itsoffset
> this post says that hstack doesn't sync with timestamps.

Post is invalid. hstack use timestamps to sync its inputs.
hstack expect same timestamps from all its inputs.

Your inputs have different starts and durations/ends and thus what
should be inserted between gaps?

You could theoretically generate filtergraph by using supplied
parameters, but that would be
very complicated at best.

>
> They do give an example in the stack overflow post:
> ffmpeg \
> -i smaller.mp4 \
> -i bigger.mp4 \
> -filter_complex \
> "[0]tpad=start_duration=17[left];\
> [left][1]hstack=inputs=2;\
> [0]adelay=17s|17s[lefta];[lefta][1]amix=2" \
> -c:v libx264 -crf 23 out.mp4
>
> Any ideas on the best way for me to proceed?
>
> Thanks,
>
> Randy
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".”
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

Carl Zwanzig
please do not op-post on this list

On 8/12/2020 6:58 AM, Randy Johnson via ffmpeg-user wrote:
> I did a ton of reading yesterday but cannot figure out how to expand this
> to more than 2 videos. I am getting hung up on how to read the
> complex_filter.
There are several examples of multi-picture filter-graphs in the ffmpeg
wiki, a quick search should turn them up.

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

FFmpeg-users mailing list
Carl,

What does "op-post" mean? I am not familiar with that term.

Thanks,
Randy
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

Carl Zwanzig
On 8/12/2020 9:13 AM, Randy Johnson via ffmpeg-user wrote:
> What does "op-post" mean? I am not familiar with that term.

Sorry, "top-post"

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Grid of videos starting at different times

FFmpeg-users mailing list

Carl Zwanzig <[hidden email]> wrote:
“On 8/12/2020 9:13 AM, Randy Johnson via ffmpeg-user wrote:
> What does "op-post" mean? I am not familiar with that term.

Sorry, "top-post"”


Thanks.  I was able to google that and learn what that meant.  Noted.  I will make sure not to top-post going forward.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".