Jump to content

I think I found a bug in transcoding when resuming?


moemoe
 Share

Go to solution Solved by Luke,

Recommended Posts

Emby 3.5.3.0 on Arch

 

ffmpeg exits with code 0 when resuming a video that require trans-coding.

 

I found the ffmpeg line in the log (filename removed):


 /usr/bin/ffmpeg -ss 00:17:30.000 -f matroska,webm -i file:"*file*.mkv" -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -vf "scale=trunc(min(max(iw\,ih*dar)\,640)/2)*2:trunc(ow/dar/2)*2" -pix_fmt yuv420p -preset veryfast -crf 20 -maxrate 616000 -bufsize 1232000 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 384000 -af "volume=2" -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -segment_time_delta -1050 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 350 -segment_list "/dev/shm/transcode/transcoding-temp/71957b765fe5222439170d81c19d6296.m3u8" -y "/dev/shm/transcode/transcoding-temp/71957b765fe5222439170d81c19d6296%d.ts"

 

I tried the same line in a terminal and got 

Value -1050.000000 for parameter 'segment_time_delta' out of range [0 - 9.22337e+12]

In other words the value for -segment_time_delta should not be negative. It works fine when i remove the "-" 

Link to comment
Share on other sites

 

2018-11-07 18:00:19.483
Application version: 3.5.3.0
 
 
{"Protocol":"File","Id":"cee4a72ab1206f206de91c8c78f12d38","Path":"file.mkv","Type":"Default","Container":"mkv,webm","Name":"name","IsRemote":false,"ETag":"084a9dd3fd4df05fd5ab75f1e0eadcca","RunTimeTicks":27654709248,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","Language":"eng","TimeBase":"1/1000","CodecTimeBase":"1001/48000","VideoRange":"SDR","DisplayTitle":"720P H264","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":3393442,"BitDepth":8,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":720,"Width":1280,"AverageFrameRate":23.9760246,"RealFrameRate":23.9760246,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":31,"IsAnamorphic":false},{"Codec":"ac3","TimeBase":"1/1000","CodecTimeBase":"1/48000","DisplayTitle":"Dolby Digital 5.1 Default","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":384000,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0,"IsAnamorphic":false},{"Codec":"srt","Language":"eng","DisplayTitle":"Eng","IsInterlaced":false,"IsDefault":false,"IsForced":false,"Type":"Subtitle","Index":2,"IsExternal":true,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Path":"name.eng.srt","IsAnamorphic":true}],"Formats":[],"Bitrate":3393442,"RequiredHttpHeaders":{}}
 
User policy for user: EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True
 
/usr/bin/ffmpeg -ss 00:02:33.000 -f matroska,webm -i file:"file.mkv" -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -pix_fmt yuv420p -preset veryfast -crf 20 -maxrate 3393442 -bufsize 6786884 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 384000 -af "volume=2" -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -segment_time_delta -153 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 51 -segment_list "/dev/shm/transcode/transcoding-temp/9a5a900d737af7382511fe53be008433.m3u8" -y "/dev/shm/transcode/transcoding-temp/9a5a900d737af7382511fe53be008433%d.ts"
 
ffmpeg version n4.1 Copyright © 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20180831
 

 

 

Note: Videos work fine when played from the start, with any quality setting. It also works with scrubbing as long as the scrubbing is withing what has been buffered. Scrubbing or resuming works fine as long as the file is played direct w/o ffmpeg involved.

 

Another one that failed is this one:

2018-11-07 18:09:41.012
Application version: 3.5.3.0

http://10.10.100.21:8096/videos/187378fae0b24b17e54c8eed9751f50e/hls1/main/726.ts?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzcwLjAuMzUzOC43NyBTYWZhcmkvNTM3LjM2fDE1NDE0NDA3NTg2MDE1&MediaSourceId=187378fae0b24b17e54c8eed9751f50e&VideoCodec=h264&AudioCodec=mp3,aac&AudioStreamIndex=1&VideoBitrate=808283&AudioBitrate=191717&PlaySessionId=0fc711d9866944698dda896012a622dd&api_key=0cc41c4935af46f7a22910da36e128a0&TranscodingMaxAudioChannels=2&RequireAvc=false&Tag=63a2207265241d4a5aaaee14642945e3&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&h264-profile=high,main,baseline,constrainedbaseline,high10&h264-level=51&TranscodeReasons=ContainerBitrateExceedsLimit

{"Protocol":"File","Id":"187378fae0b24b17e54c8eed9751f50e","Path":"file.mp4","Type":"Default","Container":"mov,mp4,m4a,3gp,3g2,mj2","Name":"name","IsRemote":false,"ETag":"63a2207265241d4a5aaaee14642945e3","RunTimeTicks":26054400000,"ReadAtNativeFramerate":false,"IgnoreDts":false,"IgnoreIndex":false,"GenPtsInput":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"RequiresLooping":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","CodecTag":"avc1","Language":"eng","TimeBase":"1/11988","CodecTimeBase":"125/5994","VideoRange":"SDR","DisplayTitle":"720P H264","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":2000088,"BitDepth":8,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":720,"Width":1280,"AverageFrameRate":23.976,"RealFrameRate":23.976,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":32,"IsAnamorphic":false},{"Codec":"aac","CodecTag":"mp4a","Language":"eng","TimeBase":"1/48000","CodecTimeBase":"1/48000","DisplayTitle":"Eng AAC stereo Default","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":191717,"Channels":2,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Profile":"LC","Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0,"IsAnamorphic":false}],"Formats":[],"Bitrate":2196862,"RequiredHttpHeaders":{}}

User policy for user: EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True

/usr/bin/ffmpeg -ss 00:36:18.000 -f mov,mp4,m4a,3gp,3g2,mj2 -i file:"file.mp4" -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -vf "scale=trunc(min(max(iw\,ih*dar)\,640)/2)*2:trunc(ow/dar/2)*2" -pix_fmt yuv420p -preset veryfast -crf 20 -maxrate 808283 -bufsize 1616566 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 copy -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -segment_time_delta -2178 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 726 -segment_list "/dev/shm/transcode/transcoding-temp/e78d9aa31920c24013484614ca4ae9fb.m3u8" -y "/dev/shm/transcode/transcoding-temp/e78d9aa31920c24013484614ca4ae9fb%d.ts"

ffmpeg version n4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20180831
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3

Link to comment
Share on other sites

  • Solution

Looks like your system has updated to ffmpeg 4.1 which we haven't tested yet. You'll need to go back to ffmpeg 4.0.2.

 

With the next release this will be a moot point because we'll be bundling our own ffmpeg inside the application. Thanks.

  • Like 1
Link to comment
Share on other sites

Yeah, I was just about to say that i just tried with a freshly installed ubuntu (lxc)box and everything worked fine there.

 

Thanks, Luke!

Link to comment
Share on other sites

Looks like your system has updated to ffmpeg 4.1 which we haven't tested yet. You'll need to go back to ffmpeg 4.0.2.

 

With the next release this will be a moot point because we'll be bundling our own ffmpeg inside the application. Thanks.

 

Don't you already bundle your own ffmpeg and ffprobe that get setup to /opt/emby-server/bin ?

Link to comment
Share on other sites

Not on arch Linux because that's not really the arch Linux way. But now that we're making our own changes we will have to.

Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...

Hey!

 

I'm having the same issue as this, but on a different platform. I'm running emby server from a FreeNAS default plugin. I haven't gone out of my way to install ffmpeg manually or anything. So I suspect it's broken for other FreeNAS users too.

 

Anyway, I can't resume any videos and when I try I get the an error:

/usr/local/bin/ffmpeg -ss 00:12:00.000 -f matroska -i file:"/media/TV/thefile.mkv" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 libx264 -pix_fmt yuv420p -maxrate 4109918 -bufsize 8219836 -preset veryfast -profile high -level 4.1 -crf 23 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -copyts -vsync -1 -codec:a:0 copy -metadata:s:a:0 language=jpn -disposition:a:0 default -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -segment_time_delta -720 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 240 -segment_list "/var/db/emby-server/transcoding-temp/dfb58276cc77456177e283b972e4832c.m3u8" -y "/var/db/emby-server/transcoding-temp/dfb58276cc77456177e283b972e4832c%d.ts"

Which gives me the error:

[segment muxer @ ] Value -480.000000 for parameter 'segment_time_delta' out of range [0 - 9.22337e+12]
[segment muxer @ ] Error setting option segment_time_delta to value -480.

ffmpeg version: 4.1.4

freeNAS: 11.2 stable

emby server: 4.0.2.0

 

And i can confirm that removing the dash in front of 480 makes ffmpeg run without error. (If I run it manually)

 

So, is this version of ffmpeg still not supported?

 

Also, for workarounds, will simply setting segment_time_delta positive work? I tried downgrading ffmpeg, but it's really painful on this system since all the dependencies need downgrading too. I'm thinking I may be able to hack together a wrapper to remove the dash or something. Thoughts?

 

Thanks!

Link to comment
Share on other sites

@@AltF4, sounds like you may have configured emby server to use your system ffmpeg, you need to use our custom supplied build.

 

How did you install emby server?

Link to comment
Share on other sites

That's curious. I just installed Emby server from the FreeNAS plugin. (Just via the FreeNAS web interface) It should be pretty vanilla honestly, I did't do any custom shenanigans with it.

 

Where should the packaged version of ffmpeg be on the local filesystem? I ought to be able to workaround the issue with a symlink. (short term anyway)

 

Thanks

Link to comment
Share on other sites

  • 2 months later...

@@AltF4 i would install Emby Server using the IOCage plugin so that you can get the latest version. I think the freenas plugin version is still really old, right?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...