Codec error when adding color parameter to fade

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

Codec error when adding color parameter to fade

Cemal Direk
Hi, im using this code

"ffmpeg -i video.mp4 -filter:v "fade=t=in:color=white:st=0.5:d=1" -filter:a
"afade=in:st=0:d=1, afade=out:st=44:d=1" -c:v libx264 -c:a aac output.mp4"

then output is wrong codec. i can not open output.mp4 at any player.
but i dont give to color=white parameter to command i can open output.mp4...
whats the problem when i adding color parameter to command?(:color=white)

how can i solve this problem?

Thank You!
_______________________________________________
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: Codec error when adding color parameter to fade

Carl Eugen Hoyos-2



> Am 21.04.2020 um 16:10 schrieb Cemal Direk <[hidden email]>:
>
> "ffmpeg -i video.mp4 -filter:v "fade=t=in:color=white:st=0.5:d=1" -filter:a
> "afade=in:st=0:d=1, afade=out:st=44:d=1" -c:v libx264 -c:a aac output.mp4"

Complete, uncut console output missing.

Carl Eugen
_______________________________________________
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: Codec error when adding color parameter to fade

pdr0
In reply to this post by Cemal Direk
Cemal Direk wrote

> Hi, im using this code
>
> "ffmpeg -i video.mp4 -filter:v "fade=t=in:color=white:st=0.5:d=1"
> -filter:a
> "afade=in:st=0:d=1, afade=out:st=44:d=1" -c:v libx264 -c:a aac output.mp4"
>
> then output is wrong codec. i can not open output.mp4 at any player.
> but i dont give to color=white parameter to command i can open
> output.mp4...
> whats the problem when i adding color parameter to command?(:color=white)
>
> how can i solve this problem?

I'm assuming you are using "regular" yuv420p input.

The default color for fade is black. When you specify white, the output
pixel format is yuv444p for some reason,  and libx264 encodes as yuv444p

As a workaround, you can add format=yuv420p to the filter chain
-filter:v "fade=t=in:color=white:st=0.5:d=1,format=yuv420p"

I don't know if that is intended behavior, but it's not in the documentation





--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
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: Codec error when adding color parameter to fade

Cemal Direk
done thnx you

 but  other problem:  iphone is not supporting  to  filter effect on phone
when im joining(merging) video...

 ffmpeg -i video.mp4 -filter:v "fade=in:color=white:st=5:d=1,
fade=out:color=white:st=44:d=1,format=yuv420p"  filtered.mp4

ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
ffmpeg -i filtered .mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts

ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

when i am sending  output.mp4  video via  whatsapp. then  android users can
see all part of video but iphone user  cant see filtered affected part.
iphone user is hearing only audio of filtered video.

now whats problem?

thank you.

pdr0 <[hidden email]>, 21 Nis 2020 Sal, 18:24 tarihinde şunu yazdı:

> Cemal Direk wrote
> > Hi, im using this code
> >
> > "ffmpeg -i video.mp4 -filter:v "fade=t=in:color=white:st=0.5:d=1"
> > -filter:a
> > "afade=in:st=0:d=1, afade=out:st=44:d=1" -c:v libx264 -c:a aac
> output.mp4"
> >
> > then output is wrong codec. i can not open output.mp4 at any player.
> > but i dont give to color=white parameter to command i can open
> > output.mp4...
> > whats the problem when i adding color parameter to command?(:color=white)
> >
> > how can i solve this problem?
>
> I'm assuming you are using "regular" yuv420p input.
>
> The default color for fade is black. When you specify white, the output
> pixel format is yuv444p for some reason,  and libx264 encodes as yuv444p
>
> As a workaround, you can add format=yuv420p to the filter chain
> -filter:v "fade=t=in:color=white:st=0.5:d=1,format=yuv420p"
>
> I don't know if that is intended behavior, but it's not in the
> documentation
>
>
>
>
>
> --
> Sent from: http://www.ffmpeg-archive.org/
> _______________________________________________
> 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: Codec error when adding color parameter to fade

pdr0
Cemal Direk wrote

>  but  other problem:  iphone is not supporting  to  filter effect on phone
> when im joining(merging) video...
>
>  ffmpeg -i video.mp4 -filter:v "fade=in:color=white:st=5:d=1,
> fade=out:color=white:st=44:d=1,format=yuv420p"  filtered.mp4
>
> ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
> ffmpeg -i filtered .mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts
>
> ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc
> output.mp4
>
> when i am sending  output.mp4  video via  whatsapp. then  android users
> can
> see all part of video but iphone user  cant see filtered affected part.
> iphone user is hearing only audio of filtered video.
>
> now whats problem?



Do the specs match for all video and audio streams ? In the first post you
used -c:a aac and -c:v libx264, but you omitted those arguments this time.

Post the full console output as Carl suggested





--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
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: Codec error when adding color parameter to fade

Cemal Direk
ok i wrote command and console step by step

i wanna  apply filter effect to second video then concat with intro.mp4 .
then  save  as .mp4.

i wrote all command together...

ffmpeg -i video.mp4 -filter:v "fade=in:color=white:st=5:d=1,
fade=out:color=white:st=45:d=1,format=yuv420p"  filtered.mp4
ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
ffmpeg -i filtered.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp2.ts
ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

with this codes there isnt any problem at android(whatsapp). but iphone
users cant see anything at filtered video but   they can hear only sound...

1-)  ffmpeg -i video.mp4 -filter:v "fade=in:color=white:st=5:d=1,
fade=out:color=white:st=45:d=1,format=yuv420p"  filtered.mp4
console:
Output #0, mp4, to 'filtered.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : Lavf58.42.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
640x352, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc58.77.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      encoder         : Lavc58.77.101 aac
frame= 1390 fps=355 q=-1.0 Lsize=    2742kB time=00:00:46.31 bitrate=
485.0kbits/s dup=1 drop=0 speed=11.8x
video:1963kB audio:728kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.896171%
[libx264 @ 00000168b8edb600] frame I:7     Avg QP:15.92  size: 17259
[libx264 @ 00000168b8edb600] frame P:369   Avg QP:21.15  size:  3872
[libx264 @ 00000168b8edb600] frame B:1014  Avg QP:24.32  size:   453
[libx264 @ 00000168b8edb600] consecutive B-frames:  2.1%  1.6%  1.1% 95.3%
[libx264 @ 00000168b8edb600] mb I  I16..4: 36.7% 34.8% 28.5%
[libx264 @ 00000168b8edb600] mb P  I16..4:  2.0%  2.5%  0.2%  P16..4: 43.5%
12.4%  9.0%  0.0%  0.0%    skip:30.5%
[libx264 @ 00000168b8edb600] mb B  I16..4:  0.3%  0.3%  0.0%  B16..8: 33.7%
 1.1%  0.1%  direct: 0.5%  skip:64.1%  L0:43.4% L1:54.0% BI: 2.5%
[libx264 @ 00000168b8edb600] 8x8 transform intra:48.2% inter:57.9%
[libx264 @ 00000168b8edb600] coded y,uvDC,uvAC intra: 27.3% 39.1% 10.1%
inter: 7.6% 8.7% 0.2%
[libx264 @ 00000168b8edb600] i16 v,h,dc,p: 42% 16% 13% 28%
[libx264 @ 00000168b8edb600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 17% 37%  2%
 4%  3%  5%  3%  2%
[libx264 @ 00000168b8edb600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 21% 14%  5%
 7%  7%  8%  6%  6%
[libx264 @ 00000168b8edb600] i8c dc,h,v,p: 61% 15% 21%  4%
[libx264 @ 00000168b8edb600] Weighted P-Frames: Y:13.0% UV:8.9%
[libx264 @ 00000168b8edb600] ref P L0: 66.7% 15.2% 13.8%  4.3%  0.1%
[libx264 @ 00000168b8edb600] ref B L0: 92.5%  6.4%  1.2%
[libx264 @ 00000168b8edb600] ref B L1: 95.2%  4.8%
[libx264 @ 00000168b8edb600] kb/s:346.95
[aac @ 00000168b8edd100] Qavg: 204.436

  2-) ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts
temp1.ts

console

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'intro.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
  Duration: 00:00:16.82, start: 0.000000, bitrate: 1353 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1080x608 [SAR 1:1 DAR 135:76], 1220 kb/s, 59.94 fps, 59.94 tbr, 60k tbn,
120k tbc (default)
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
Output #0, mpegts, to 'temp1.ts':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : Lavf58.42.100
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1080x608 [SAR 1:1 DAR 135:76], q=2-31, 1220 kb/s, 59.94 fps, 59.94 tbr, 90k
tbn, 60k tbc (default)
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1008 fps=0.0 q=-1.0 Lsize=    3043kB time=00:00:16.80
bitrate=1483.7kbits/s speed=1.53e+03x
video:2507kB audio:263kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 9.821584%

3-) ffmpeg -i filtered.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts
temp2.ts

console:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filtered.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.42.100
  Duration: 00:00:46.34, start: 0.000000, bitrate: 484 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x352, 347 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, mpegts, to 'temp2.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.42.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x352, q=2-31, 347 kb/s, 30 fps, 30 tbr, 90k tbn, 15360 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1390 fps=0.0 q=-1.0 Lsize=    3161kB time=00:00:46.29 bitrate=
559.4kbits/s speed=2.9e+03x
video:1963kB audio:728kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 17.464737%

4-) ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc
output.mp4

console

Input #0, mpegts, from 'concat:temp1.ts|temp2.ts':
  Duration: 00:00:46.38, start: 1.400000, bitrate: 1095 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1080x608 [SAR 1:1 DAR 135:76], 59.94 fps, 59.94 tbr,
90k tbn, 180k tbc
    Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 121 kb/s
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf58.42.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(progressive), 1080x608 [SAR 1:1 DAR 135:76], q=2-31, 59.94 fps,
59.94 tbr, 90k tbn, 90k tbc
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 121 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0000016cf83cb3c0] Packet corrupt (stream = 0, dts = 1638011).
frame= 2398 fps=0.0 q=-1.0 Lsize=    5553kB time=00:01:03.19 bitrate=
719.9kbits/s speed=1.14e+03x
video:4484kB audio:991kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.415062%

pdr0 <[hidden email]>, 21 Nis 2020 Sal, 20:24 tarihinde şunu yazdı:

> Cemal Direk wrote
> >  but  other problem:  iphone is not supporting  to  filter effect on
> phone
> > when im joining(merging) video...
> >
> >  ffmpeg -i video.mp4 -filter:v "fade=in:color=white:st=5:d=1,
> > fade=out:color=white:st=44:d=1,format=yuv420p"  filtered.mp4
> >
> > ffmpeg -i intro.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts
> > ffmpeg -i filtered .mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts
> temp2.ts
> >
> > ffmpeg -i "concat:temp1.ts|temp2.ts" -c copy -bsf:a aac_adtstoasc
> > output.mp4
> >
> > when i am sending  output.mp4  video via  whatsapp. then  android users
> > can
> > see all part of video but iphone user  cant see filtered affected part.
> > iphone user is hearing only audio of filtered video.
> >
> > now whats problem?
>
>
>
> Do the specs match for all video and audio streams ? In the first post you
> used -c:a aac and -c:v libx264, but you omitted those arguments this time.
>
> Post the full console output as Carl suggested
>
>
>
>
>
> --
> Sent from: http://www.ffmpeg-archive.org/
> _______________________________________________
> 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: Codec error when adding color parameter to fade

pdr0


When appending videos, you usually need to match the specs for the video,
including dimensions, framerate, pixel format

filtered.mp4 is 640x352, 30fps

intro.mp4 is 1080x608, 59.94fps

My guess is that is part of the reason.  The specs can change midstream for
a transport stream, but some players , decoders might have problems with it.
MP4 container does not support changes midstream as well as transport
streams

The aspect ratio is slightly different between them. 1.818 vs. 1.776. You'd
have to letterbox the filtered version if converting that up; or if you
didn't care about the AR error, then just resize it





--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
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".