我使用以下代码通过ffprobe提取视频信息:
ffprobe -show_streams -of json -v quiet -i input.mp4
Run Code Online (Sandbox Code Playgroud)
所有流的信息都出现在输出中,而我只需要v:0和a:0流的信息。
我知道有-select_streams选择流的选项,但它仅接受一个参数,例如:-select_streams v:0。
我可以使用-select_streams两个参数v:0,a:0也可以使用两次吗?
我有一个用户模型,它有一个帖子集合。我想返回用户数据及其帖子的集合,但每个用户的特殊帖子除外;为此,我使用此代码:
$users=User::with('posts')->get();
foreach($users as $user){
$user->posts=$user->posts->except($except_id);
// $user->posts=null;// ->>> also this code does not work
}
return $users;
Run Code Online (Sandbox Code Playgroud)
但在输出中用户的帖子没有改变!
编辑:
$except_id = $user->golden_post_id;
Run Code Online (Sandbox Code Playgroud)