Problem getting 2 croped video streams +audio

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem getting 2 croped video streams +audio

FFmpeg-users mailing list
Hi,

 

From a rtsp flux (1 video stream + 1 audio stream), I would like to record 3
files: 2 video files containing only the video stream (corresponding to left
and right parts of the video) and 1 audio file containing only the audio
stream (mono).

My command is doing something but the left file is containing the full size
video and according to its size also probably contain some audio (not
detected by VLC reader), can you help me please ?

Thank you in advance

 

 

COMMAND

ffmpeg -loglevel warning -r  12 -rtsp_transport tcp -i
"rtsp://login:pass@XXXX:554/12"

-map 0:a:0 -t 00:00:10 audio.wav

-map 0:v:0 -filter_complex [0:v]crop=in_w/2:in_h:0:0[out_L] -filter_complex
[0:v]crop=in_w/2:in_h:in_w/2:0[out_R]

-map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L"
videoL.mp4

-map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_R"
videoR.mp4

 

OUTPUT OF ABOVE COMMAND

c:v libx265 -metadata title="id_R" videoR.mp4

x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe

x265 [info]: build info [Linux][GCC 9.2.1][64 bit] 8bit+10bit+12bit

x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
FMA3 BMI2 AVX2

x265 [info]: Main profile, Level-2.1 (Main tier)

x265 [info]: Thread pool 0 using 64 threads on numa nodes 0,1,2,3

x265 [info]: Slices                              : 1

x265 [info]: frame threads / pool features       : 5 / wpp(10 rows)

x265 [warning]: Source height < 720p; disabling lookahead-slices

x265 [info]: Coding QT: max CU size, min CU size : 64 / 8

x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra

x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3

x265 [info]: Keyframe min / max / scenecut / bias: 12 / 250 / 40 / 5.00

x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2

x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0

x265 [info]: References / ref-limit  cu / depth  : 3 / off / on

x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1

x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60

x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra

x265 [info]: tools: strong-intra-smoothing deblock sao

x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe

x265 [info]: build info [Linux][GCC 9.2.1][64 bit] 8bit+10bit+12bit

x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
FMA3 BMI2 AVX2

x265 [info]: Main profile, Level-2.1 (Main tier)

x265 [info]: Thread pool 0 using 64 threads on numa nodes 0,1,2,3

x265 [info]: Slices                              : 1

x265 [info]: frame threads / pool features       : 5 / wpp(10 rows)

x265 [warning]: Source height < 720p; disabling lookahead-slices

x265 [info]: Coding QT: max CU size, min CU size : 64 / 8

x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra

x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3

x265 [info]: Keyframe min / max / scenecut / bias: 12 / 250 / 40 / 5.00

x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2

x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0

x265 [info]: References / ref-limit  cu / depth  : 3 / off / on

x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1

x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60

x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra

x265 [info]: tools: strong-intra-smoothing deblock sao

x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe

x265 [info]: build info [Linux][GCC 9.2.1][64 bit] 8bit+10bit+12bit

x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
FMA3 BMI2 AVX2

x265 [info]: Main profile, Level-3 (Main tier)

x265 [info]: Thread pool 0 using 64 threads on numa nodes 0,1,2,3

x265 [info]: Slices                              : 1

x265 [info]: frame threads / pool features       : 5 / wpp(10 rows)

x265 [warning]: Source height < 720p; disabling lookahead-slices

x265 [info]: Coding QT: max CU size, min CU size : 64 / 8

x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra

x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3

x265 [info]: Keyframe min / max / scenecut / bias: 12 / 250 / 40 / 5.00

x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2

x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0

x265 [info]: References / ref-limit  cu / depth  : 3 / off / on

x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1

x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60

x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra

x265 [info]: tools: strong-intra-smoothing deblock sao

x265 [info]: frame I:      1, Avg QP:21.29  kb/s: 5491.10

x265 [info]: frame P:     33, Avg QP:25.30  kb/s: 616.08  

x265 [info]: frame B:     86, Avg QP:32.34  kb/s: 6.62    

x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

x265 [info]: consecutive B-frames: 2.9% 11.8% 17.6% 64.7% 2.9%

 

encoded 120 frames in 1.61s (74.66 fps), 219.93 kb/s, Avg QP:30.31

x265 [info]: frame I:      1, Avg QP:21.11  kb/s: 2617.25

x265 [info]: frame P:     32, Avg QP:25.87  kb/s: 303.05  

x265 [info]: frame B:     87, Avg QP:32.20  kb/s: 5.27    

x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

x265 [info]: consecutive B-frames: 3.0% 6.1% 18.2% 69.7% 3.0%

 

encoded 120 frames in 1.76s (68.19 fps), 106.45 kb/s, Avg QP:30.42

x265 [info]: frame I:      1, Avg QP:21.40  kb/s: 2881.63

x265 [info]: frame P:     33, Avg QP:25.81  kb/s: 321.76  

x265 [info]: frame B:     86, Avg QP:32.29  kb/s: 5.58    

x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%

x265 [info]: consecutive B-frames: 2.9% 11.8% 17.6% 64.7% 2.9%

 

encoded 120 frames in 1.71s (70.08 fps), 116.50 kb/s, Avg QP:30.42

 

OUTPUT OF FFPROBE ON USED RTSP FLUX

Input #0, rtsp, from 'rtsp://XXXX:

  Metadata:

   title           : 11

  Duration: N/A, start: 0.000000, bitrate: N/A

    Stream #0:0: Video: h264 (Baseline), yuvj420p(pc, bt470bg/bt470bg/bt709,
progressive), 800x600, 12 fps, 12 tbr, 90k tbn, 180k tbc

    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s

_______________________________________________
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: Problem getting 2 croped video streams +audio

Moritz Barsnick
Hi Fabrice,

On Mon, Jan 20, 2020 at 18:19:22 +0100, Fabrice DUPRAT via ffmpeg-user wrote:
> From a rtsp flux (1 video stream + 1 audio stream), I would like to record 3
> files: 2 video files containing only the video stream (corresponding to left
> and right parts of the video) and 1 audio file containing only the audio
> stream (mono).
>
> My command is doing something but the left file is containing the full size
> video and according to its size also probably contain some audio (not
> detected by VLC reader), can you help me please ?
[...]

> ffmpeg -loglevel warning -r  12 -rtsp_transport tcp -i
> "rtsp://login:pass@XXXX:554/12"
> -map 0:a:0 -t 00:00:10 audio.wav
> -map 0:v:0 -filter_complex [0:v]crop=in_w/2:in_h:0:0[out_L] -filter_complex [0:v]crop=in_w/2:in_h:in_w/2:0[out_R]
> -map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L" videoL.mp4
> -map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_R" videoR.mp4
>
> OUTPUT OF ABOVE COMMAND
>
> c:v libx265 -metadata title="id_R" videoR.mp4

On this list, we kindly ask you to provide us with the complete, uncut
output of your ffmpeg command. And that implies not using
"-hide_banner" (which you didn't, obviously), and not reducing the log
level.

With "-loglevel warning", you are asking ffmpeg not to give you all the
useful information. Useful not only for us, but also for you. For
example, ffmpeg tells you which inputs it is mapping to which filters,
which it is mapping to which outputs.

That said, I can explain your issue from the command line:

> -map 0:a:0 -t 00:00:10 audio.wav
> -map 0:v:0 -filter_complex [0:v]crop=in_w/2:in_h:0:0[out_L] -filter_complex [0:v]crop=in_w/2:in_h:in_w/2:0[out_R]
> -map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L" videoL.mp4
> -map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_R" videoR.mp4

You are providing three outputs (as you did explain), but four "-map"
instructions. So the second and the third "-map" both map to output
videoL.mp4. In other words, videoL.mp4 will contain both "0:v:0" and
"[out_L]" as separate video streams. If you fiddle with VLC's menus,
you will see both streams.

(Furthermore I thought that you cannot use "-filter_complex" twice, but
it turns out you can.. You can also define several chains by using one
such option and separating the chains with ';'."

This would be your correct command line (guesssing a bit here -
untested):

$ ffmpeg -r 12 -rtsp_transport tcp -i "rtsp://login:pass@XXXX:554/12" \
-map 0:a:0 -t 00:00:10 audio.wav \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0[out_L]; [0:v]crop=in_w/2:in_h:in_w/2:0[out_R]" \
-map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L" videoL.mp4 \
-map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_R" videoR.mp4

(Not sure whether you can use "[0:v]" twice, but you'll see.)

Cheers,
Moritz
_______________________________________________
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: Problem getting 2 croped video streams +audio

FFmpeg-users mailing list
Moritz

Thank you very much for your advices, it is working perfectly


On this list, we kindly ask you to provide us with the complete, uncut output of your ffmpeg command. And that implies not using "-hide_banner" (which you didn't, obviously), and not reducing the log level.

With "-loglevel warning", you are asking ffmpeg not to give you all the useful information. Useful not only for us, but also for you. For example, ffmpeg tells you which inputs it is mapping to which filters, which it is mapping to which outputs.

That said, I can explain your issue from the command line:

> -map 0:a:0 -t 00:00:10 audio.wav
> -map 0:v:0 -filter_complex [0:v]crop=in_w/2:in_h:0:0[out_L]
> -filter_complex [0:v]crop=in_w/2:in_h:in_w/2:0[out_R]
> -map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L"
> videoL.mp4 -map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata
> title="id_R" videoR.mp4

You are providing three outputs (as you did explain), but four "-map"
instructions. So the second and the third "-map" both map to output videoL.mp4. In other words, videoL.mp4 will contain both "0:v:0" and "[out_L]" as separate video streams. If you fiddle with VLC's menus, you will see both streams.

(Furthermore I thought that you cannot use "-filter_complex" twice, but it turns out you can.. You can also define several chains by using one such option and separating the chains with ';'."

This would be your correct command line (guesssing a bit here -
untested):

$ ffmpeg -r 12 -rtsp_transport tcp -i "rtsp://login:pass@XXXX:554/12" \ -map 0:a:0 -t 00:00:10 audio.wav \ -filter_complex "[0:v]crop=in_w/2:in_h:0:0[out_L]; [0:v]crop=in_w/2:in_h:in_w/2:0[out_R]" \ -map [out_L] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_L" videoL.mp4 \ -map [out_R] -t 00:00:10 -r 12 -y -c:v libx265 -metadata title="id_R" videoR.mp4

(Not sure whether you can use "[0:v]" twice, but you'll see.)

Cheers,
Moritz


_______________________________________________
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".