Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Inconsistent vod output codec #3

Closed
joschahenningsen opened this issue Nov 5, 2021 · 3 comments · Fixed by #24
Closed

Inconsistent vod output codec #3

joschahenningsen opened this issue Nov 5, 2021 · 3 comments · Fixed by #24
Assignees

Comments

@joschahenningsen
Copy link
Owner

For some reason, some recordings are transcoded into another codec than others before making them available as vod. This is a problem because those videos can not be played in firefox.

originally reported at TUM-Dev/gocast#149

Problematic video:

  • Codec: avc1.64003e,mp4a.40.2
  • ffprobe:
Duration: 02:02:41.45, start: 0.000000, bitrate: N/A
  Program 0 
    Metadata:
      variant_bitrate : 342520
    Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Metadata:
      variant_bitrate : 342520
    Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720, 60 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 342520
    Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp
    Metadata:
      variant_bitrate : 342520
  • mediainfo:
Video
ID                                       : 1-256 (0x100)
Menu ID                                  : 1-1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L6.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Muxing mode                              : HLS / MPEG-TS
Codec ID                                 : 27
Duration                                 : 8 s 606 ms
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 155 r2917 0a84d98
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=9 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=24.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                                       : 1-257 (0x101)
Menu ID                                  : 1-1 (0x1)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Format version                           : Version 4
Muxing mode                              : HLS / MPEG-TS / ADTS
Codec ID                                 : 15-2
Duration                                 : 8 s 567 ms
Bit rate mode                            : Variable
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -66 ms
Source                                   : chunklist_w658549093.m3u8
Source_Original                          : media_w658549093_0.ts

known good video:

  • codec: avc1.64001f,mp4a.40.2
  • ffprobe:
Duration: 01:58:06.28, start: 0.000000, bitrate: N/A
  Program 0 
    Metadata:
      variant_bitrate : 2575771
    Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Metadata:
      variant_bitrate : 2575771
    Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720, 29 fps, 29 tbr, 90k tbn, 58.01 tbc
    Metadata:
      variant_bitrate : 2575771
    Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp
    Metadata:
      variant_bitrate : 2575771
  • mediainfo:
Video
ID                                       : 1-256 (0x100)
Menu ID                                  : 1-1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Muxing mode                              : HLS / MPEG-TS
Codec ID                                 : 27
Duration                                 : 8 s 618 ms
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 155 r2917 0a84d98
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=9 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                                       : 1-257 (0x101)
Menu ID                                  : 1-1 (0x1)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Format version                           : Version 4
Muxing mode                              : HLS / MPEG-TS / ADTS
Codec ID                                 : 15-2
Duration                                 : 8 s 567 ms
Bit rate mode                            : Variable
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -69 ms
Source                                   : chunklist_w293289683.m3u8
Source_Original                          : media_w293289683_0.ts
@joschahenningsen
Copy link
Owner Author

cmd = exec.Command("nice", "-n", "8", "ffmpeg", "-y", "-nostats", "-i", in, "-vsync", "2", "-c:v", "libx264", "-c:a", "aac", "-b:a", "128k", "-crf", "24", out)

Might be the vsync...

@joschahenningsen
Copy link
Owner Author

joschahenningsen commented Nov 5, 2021

The current encoding is not too complex. This is a little more carefully crafted but takes a little longer:

ffmpeg -nostats -y -i input.ts \
    -c:v libx264 -crf 23 -maxrate 3700k -bufsize 7400k \
    -profile:v high -level 4.0 -pix_fmt yuv420p \
    -x264-params keyint=25:min-keyint=25:no-scenecut -movflags +faststart \
    -vf scale='-2:min(ih\,1080)',fps=fps=25 \
    -c:a aac -b:a 128k -ac 1 \ 
    -f mp4 output.mp4

@joschahenningsen
Copy link
Owner Author

todo: -profile:v high -level:v 4.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant