Jump to content

ffmpeg


wstewart
 Share

Recommended Posts

wstewart

in emby 4.6.7, i was able to use ffmpeg from the command line by running /share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/emby-ffmpeg.  now that no longer works with 4.7.2, I get

/share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/emby-ffmpeg: line 17: /share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/ffmpeg: No such file or directory


I would very much like to use the emby ffmpeg in my post.sh script that re-encodes DVR recordings.  the reason being is this is the only version of ffmpeg that I have found that has QSV acceleration enabled.

Is it still possible to use ffmpeg from command line in emby 4.7.2?

 

Link to comment
Share on other sites

Happy2Play

Have you checked the path in the top of a server log?

Example from some else's log.

/share/CACHEDEV3_DATA/.qpkg/EmbyServer/bin/ffmpeg

 

Link to comment
Share on other sites

wstewart

it is in fact where i expect to be, the the emby log it shows:   /share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/ffmpeg

if I try to run /share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/ffmpeg from ssh shell I get

-sh: /share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/ffmpeg: No such file or directory

ffmpeg is in fact in that directory and marked as executable, no idea why it doesn't directly run.  I seem to recall from 4.6.7 that I couldn't run ffmpeg directly from shell either.  I assumed that emby-ffmpeg was included as a wrapper for emby included ffmpeg.

it seems that emby-ffmpeg might not have been updated in the latest version, 4.7.2,  by the file date

-rwxr-xr-x 1 admin administrators    638 2021-11-17 07:06 emby-ffdetect*
-rwxr-xr-x 1 admin administrators    636 2021-11-17 07:06 emby-ffmpeg*
-rwxr-xr-x 1 admin administrators   1027 2022-06-03 15:30 emby-server*
-rwxr-xr-x 1 admin administrators 100248 2022-06-03 15:30 ffdetect*
-rwxr-xr-x 1 admin administrators 894968 2022-06-03 15:30 ffmpeg*
-rwxr-xr-x 1 admin administrators 760344 2022-06-03 15:30 ffprobe*

as I mentioned, i call emby-ffmpeg from my post.sh script to re-encode my recordings.  I would really like to use the emby ffmpeg since it supports qsv acceleration (at least the 4.6.7 version did)

Link to comment
Share on other sites

alucryd

Didn't think anyone used these scripts directly, they live in a different directory in our qnap template so I completely forgot about them. Will be fixed in the next version, in the meantime you can modify your post.sh to cd into the emby directory prior to calling emby-ffmpeg, or add the line in the emby-ffmpeg script directly. Here's what a complete script should look like:

#!/bin/sh

APP_DIR=$(getcfg EmbyServer Install_Path -f /etc/config/qpkg.conf)
NVIDIA_DIR=$(getcfg NVIDIA_GPU_DRV Install_Path -f /etc/config/qpkg.conf)

export AMDGPU_IDS="$APP_DIR"/share/libdrm/amdgpu.ids
export FONTCONFIG_PATH="$APP_DIR"/etc/fonts
export LD_LIBRARY_PATH="$APP_DIR"/lib
if [ -n "$NVIDIA_DIR" ]; then
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$NVIDIA_DIR"/usr/lib
fi
export LIBVA_DRIVERS_PATH="$APP_DIR"/lib/dri
export OCL_ICD_VENDORS="$APP_DIR"/etc/OpenCL/vendors
export PCI_IDS_PATH="$APP_DIR"/share/hwdata/pci.ids
export SSL_CERT_FILE="$APP_DIR"/etc/ssl/certs/ca-certificates.crt

cd "$APP_DIR" || exit 1

exec "$APP_DIR"/bin/ffdetect "$@"

 

Link to comment
Share on other sites

wstewart

thank you so much, that does seem to work now.  did not realize that emby-ffmpeg was actually a script.

FYI, the reason I use the emby ffmpeg is that the one included on QNAP is really old, the only other version I found is on qnapclub.eu and it does not have qsv acceleration compiled in.  the emby version does and processes at a much higher frame rate.

Soon I'll post a how-to on my post script for QNAP that does comskip processing and mpeg2 to h264 conversion, works well with the comskip plugin.  i managed to find a compiled version of comskip elsewhere for qnap so that i didn't have to go to the trouble of compiling it.

Link to comment
Share on other sites

wstewart

i have another problem now, ffmpeg with emby 4.7.2 is not working the same as it was with 4.6.3.  Files that previously did encode to h264, now throw a segmentation fault with the same options.

Newer recordings, instead give

[h264_qsv @ 0xe7f600] Error during encoding: device failed (-17)
Video encoding failed
Conversion failed!
 

I run as follows from my script, with $input and $out output derived from the file with full path specified as a parameter to the script.

/share/CACHEDEV1_DATA/.qpkg/EmbyServer/bin/emby-ffmpeg -i "$input" -threads 2 -vf yadif -c:v  h264_qsv -global_quality 20 -c:a copy "$out"

Any ideas?

 

Link to comment
Share on other sites

Quote

-c:v  h264_qsv

It might not be as simple as just being able to use that. Look at our hardware transcoding command lines and how they're considerably more complex than this.

Link to comment
Share on other sites

Why not just use the conversion feature inside emby server to do the same thing?

Link to comment
Share on other sites

wstewart
45 minutes ago, Luke said:

Why not just use the conversion feature inside emby server to do the same thing?

I have my post recording script setup to first run comskip, then after that run ffmpeg to encode to h264 to reduce size, then move the original recording to another directory for later deletion (haven't taken the time to figure out way to check if ffmpeg succeeded on the encode), then I trigger a library update.  I've attached my script for reference, once i get it working i plan a how-to.  I didn't see a way to do that with the conversion future in emby.  maybe i could do just the h264 conversion with the emby conversion future, is it possible to trigger the conversion feature automatically after a record is completed?

 

ps.  if anyone watching this thread wants to use my script, the curl line needs to be customized for your specific setup (library and apikey)

post.sh

Link to comment
Share on other sites

  • 3 months later...

@wstewart we've got a fix in 4.8.0.11. Can you please try that once it is available for your QNAP and let us know if that resolves the issue for you? Thanks !

Link to comment
Share on other sites

  • 4 weeks later...

ok will do.  just upgraded to 4.7.9, i'll make sure that is stabe for me first, then upgrade to 4.8.0.16

Edited by wstewart
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

it has in fact fixed it.  my post.sh script now runs after every recording.  thanks!

but i can't seem to get the built in video conversion to work, it queues the conversion but never runs.  I want to check the log for the command line options used for ffmpeg to use the same in my script.  Any idea why conversion aren't running?  On 4.8.0.16 at moment, will try 4.8.0.19 shortly.

Link to comment
Share on other sites

1 minute ago, wstewart said:

it has in fact fixed it.  my post.sh script now runs after every recording.  thanks!

but i can't seem to get the built in video conversion to work, it queues the conversion but never runs.  I want to check the log for the command line options used for ffmpeg to use the same in my script.  Any idea why conversion aren't running?  On 4.8.0.16 at moment, will try 4.8.0.19 shortly.

That should be resolved in newer builds. Thanks.

Link to comment
Share on other sites

yep you are right, just upgraded to 4.8.0.19 and the conversion is running at the moment

  • Thanks 1
Link to comment
Share on other sites

i am finding that the emby conversion are quite jerky/choppy.  the same for encodes using my script that calls the emby ffmpeg with my own/different options.  I tried an external media player (Nova) and it is the same, choppy, so I don't think it is emby on the playback side.  I'm reviewing some older encodes that I made, I'm not 100% certain, but I don't think  they are choppy.  when i convert with emby I choose custom and either original quality or set a bit rate.

still investigating, but thinking it is either the ffmpeg version or the encode options.  i have another version of ffmpeg installed that I'll try.

this is on 2017 nvidia shield.  I think there was an update not too long ago, so it is not beyond possibility it is shield related and nothing to do with emby or ffmpeg

Any ideas?

Edited by wstewart
Link to comment
Share on other sites

3 hours ago, wstewart said:

i am finding that the emby conversion are quite jerky/choppy.  the same for encodes using my script that calls the emby ffmpeg with my own/different options.  I tried an external media player (Nova) and it is the same, choppy, so I don't think it is emby on the playback side.  I'm reviewing some older encodes that I made, I'm not 100% certain, but I don't think  they are choppy.  when i convert with emby I choose custom and either original quality or set a bit rate.

still investigating, but thinking it is either the ffmpeg version or the encode options.  i have another version of ffmpeg installed that I'll try.

this is on 2017 nvidia shield.  I think there was an update not too long ago, so it is not beyond possibility it is shield related and nothing to do with emby or ffmpeg

Any ideas?

It's more likely how it's used than the build of ffmpeg itself. We'd have to look at a specific example. Thanks.

Link to comment
Share on other sites

my post.sh script is no longer running again.  "Recording post-processing script completed with exit code 132" in log.  I think this is due to the upgrade to 4.8.0.19, it was working with 4.8.0.16.

Is it safe to downgrade to 4.8.0.16?  I could at least confirm it is emby and not something else.

Edited by wstewart
Link to comment
Share on other sites

4 hours ago, wstewart said:

my post.sh script is no longer running again.  "Recording post-processing script completed with exit code 132" in log.  I think this is due to the upgrade to 4.8.0.19, it was working with 4.8.0.16.

Is it safe to downgrade to 4.8.0.16?  I could at least confirm it is emby and not something else.

Hi @wstewart can you please attach the emby server log? Thanks.

Link to comment
Share on other sites

ok thanks awesome, will do.  most tv shows on hiatus so not much to record and post process at the moment anyway.  still have to figure out ffmpeg anyway.

  • Thanks 1
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...